--------------------------------------------------------------------------------------------------------
      name:  rep
       log:  /Users/souleymane.yameogo/Library/CloudStorage/Dropbox/WP3_OnlineCivics/Conflict project/Co
> nflict-Nigeria/Observationaldata/R9-Acled/JCR replication/output/02_analysis.log
  log type:  text
 opened on:   7 Dec 2025, 15:21:27
r; t=0.00 15:21:27

. 
. ***************************************************************
. * 1. LOAD MICRO DATA & DEFINE COVARIATES / OUTCOMES
. ***************************************************************
. 
. use "${data}/R9_final.dta", clear
r; t=8.56 15:21:36

. 
. //use "${main}data_final.dta", clear
. 
. * Ensure surveyyear exists (for FE)
. capture confirm variable surveyyear
r; t=0.00 15:21:36

. if _rc {
.     capture confirm variable year
r; t=0.00 15:21:36
.     if !_rc gen surveyyear = year
r; t=0.00 15:21:36
.     label var surveyyear "Survey year (from interview date)"
r; t=0.00 15:21:36
. }
r; t=0.00 15:21:36

. 
. * Covariates for weighting & regressions
. global cvars age gender race_group religion ethnic urban_rural educ_group emp_group ///
>              safety fearing_crime voted discuss_politics ///
>              police_station soldiers_army piped_water
r; t=0.00 15:21:36

. 
. * Same covariates with factor notation for balance regressions (Appendix)
. global cvars_demographics age gender ib1.race_group ib1.religion ethnic ///
>                            ib1.urban_rural ib4.educ_group ///
>                            safety fearing_crime voted ///
>                            police_station soldiers_army piped_water
r; t=0.00 15:21:36

. 
. * Outcomes (original scale)
. global outcomes_groups demo_support auth_support demo_rated
r; t=0.00 15:21:36

. 
. ***************************************************************
. * 2. RESTRICT SAMPLE: COUNTRIES WITH BOTH TREATED & CONTROL
. ***************************************************************
. 
. preserve
r; t=0.47 15:21:36

.     gen flag_0 = (time_zero == 0)
r; t=0.00 15:21:36

.     gen flag_1 = (time_zero == 1)
r; t=0.00 15:21:36

. 
.     collapse (max) flag_0 flag_1, by(cntrynum)
r; t=0.69 15:21:37

. 
.     gen keep_country = (flag_0 == 1 & flag_1 == 1)
r; t=0.00 15:21:37

.     keep if keep_country
(18 observations deleted)
r; t=0.00 15:21:37

. 
.     keep cntrynum
r; t=0.00 15:21:37

.     tempfile good_countries
r; t=0.00 15:21:37

.     save `good_countries'
file /var/folders/xw/4b35bsn11yjdb9q5jx7fll_h0000gq/T//S_00928.000002 saved as .dta format
r; t=0.00 15:21:37

. restore
r; t=0.11 15:21:37

. 
. * Keep only countries that have both time_zero values
. merge m:1 cntrynum using `good_countries', keep(match) nogen
(label cntrynum already defined)

    Result                      Number of obs
    -----------------------------------------
    Not matched                             0
    Matched                            10,201  
    -----------------------------------------
r; t=0.02 15:21:37

. 
. * Save restricted dataset (used later for country plots)
. save "${data_new}/data_goodcountries.dta", replace
file /Users/souleymane.yameogo/Library/CloudStorage/Dropbox/WP3_OnlineCivics/Conflict
    project/Conflict-Nigeria/Observationaldata/R9-Acled/JCR replication/output/Generated
    data/data_goodcountries.dta saved
r; t=0.25 15:21:38

. 
. ***************************************************************
. * 3. STANDARDISE OUTCOMES (0–1) IN RESTRICTED SAMPLE
. ***************************************************************
. 
. * z-prefix is min–max scaling to [0,1]
. foreach v of varlist $outcomes_groups {
  2.     qui summ `v'
  3.     gen z`v' = (`v' - r(min)) / (r(max) - r(min))
  4. }
(211 missing values generated)
(67 missing values generated)
(338 missing values generated)
r; t=0.00 15:21:38

. 
. * Main z-outcomes used throughout
. global zoutcomes_group1 zdemo_support zauth_support zdemo_rated
r; t=0.00 15:21:38

. 
. summarize $cvars

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
         age |     10,198    38.12287    14.83255         18        103
      gender |     10,201    .5004411    .5000243          0          1
  race_group |     10,201    1.169101    .5485543          1          3
    religion |     10,188    1.906066    1.027028          1          5
      ethnic |      9,919    737.5419    509.6777          4       2750
-------------+---------------------------------------------------------
 urban_rural |     10,201    1.594157    .4910784          1          2
  educ_group |     10,185    1.988611    .9214366          1          4
   emp_group |     10,192    1.541503    .8200009          1          3
      safety |     10,195    1.489259    .7457665          1          3
fearing_cr~e |     10,198    1.377917    .6916123          1          3
-------------+---------------------------------------------------------
       voted |      9,646    .7521252    .4318011          0          1
discuss_po~s |     10,170    .8554572    .6965293          0          2
police_sta~n |     10,201    .3528085    .4778672          0          1
soldiers_a~y |     10,201    .0799922    .2712944          0          1
 piped_water |     10,201    .5034801    .5000124          0          1
r; t=0.00 15:21:38

. summarize $zoutcomes_group1

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
zdemo_supp~t |      9,990    .7117117    .4529886          0          1
zauth_supp~t |     10,134       .7842    .2834817          0          1
 zdemo_rated |      9,863    .5276792    .2740082          0          1
r; t=0.00 15:21:38

. 
. ***************************************************************
. * 4. MAIN REGRESSION (TABLE 1) WITH ENTROPY BALANCING
. ***************************************************************
. 
. * Treatment indicator
. global treatments time_zero 
r; t=0.00 15:21:38

. 
. * Entropy balancing weights
. //drop balance_zero
. ebalance time_zero $cvars, generate(balance_zero) targets(3)


Data Setup
Treatment variable:   time_zero
Covariate adjustment: age gender race_group religion ethnic urban_rural educ_group emp_group safety fear
> ing_crime voted discuss_politics police_station soldiers_army piped_water (1st order). age gender race
> _group religion ethnic urban_rural educ_group emp_group safety fearing_crime voted discuss_politics po
> lice_station soldiers_army piped_water (2nd order). age gender race_group religion ethnic urban_rural 
> educ_group emp_group safety fearing_crime voted discuss_politics police_station soldiers_army piped_wa
> ter (3rd order).


Optimizing...
Iteration 1: Max Difference = 22351.177
Iteration 2: Max Difference = 8220.52483
Iteration 3: Max Difference = 3022.14949
Iteration 4: Max Difference = 1109.77703
Iteration 5: Max Difference = 406.262531
Iteration 6: Max Difference = 147.475677
Iteration 7: Max Difference = 52.3312784
Iteration 8: Max Difference = 17.4791893
Iteration 9: Max Difference = 4.99961192
Iteration 10: Max Difference = .990642593
Iteration 11: Max Difference = .087979281
Iteration 12: Max Difference = .00120722
maximum difference smaller than the tolerance level; convergence achieved


Treated units: 6047    total of weights: 6047
Control units: 3285    total of weights: 6047


Before: without weighting

             |              Treat              |             Control             
             |      mean   variance   skewness |      mean   variance   skewness 
-------------+---------------------------------+--------------------------------
         age |     38.77      210.3      .7741 |     39.49      223.4      .7352 
      gender |     .4998        .25   .0009922 |     .4998      .2501   .0006088 
  race_group |     1.191      .3344      2.753 |     1.129      .2393      3.539 
    religion |     1.851      1.051      1.173 |     1.976      1.043      1.001 
      ethnic |     762.3     254093      .5954 |     680.6     260394      .6825 
 urban_rural |     1.559      .2466     -.2361 |     1.661       .224     -.6825 
  educ_group |     1.979       .877      .5577 |      1.95      .8321      .4651 
   emp_group |     1.568      .6933      .9472 |      1.52      .6559      1.083 
      safety |     1.514      .5753      1.071 |     1.441      .5116      1.293 
fearing_cr~e |     1.391      .4883      1.491 |     1.358      .4625      1.634 
       voted |     .7341      .1952      -1.06 |      .783        .17     -1.373 
discuss_po~s |     .8662      .4675      .1759 |     .8533      .5028       .218 
police_sta~n |     .3651      .2319      .5602 |     .3169      .2165      .7871 
soldiers_a~y |     .1005     .09045      2.657 |     .0347     .03351      5.084 
 piped_water |     .5295      .2492     -.1183 |     .4581      .2483       .168 


After:  balance_zero as the weighting variable

             |              Treat              |             Control             
             |      mean   variance   skewness |      mean   variance   skewness 
-------------+---------------------------------+--------------------------------
         age |     38.77      210.3      .7741 |     38.77      210.3      .7739 
      gender |     .4998        .25   .0009922 |     .4997      .2501    .001004 
  race_group |     1.191      .3344      2.753 |     1.191      .3344      2.753 
    religion |     1.851      1.051      1.173 |     1.851      1.051      1.173 
      ethnic |     762.3     254093      .5954 |     762.3     254118      .5954 
 urban_rural |     1.559      .2466     -.2361 |     1.559      .2466     -.2364 
  educ_group |     1.979       .877      .5577 |     1.979       .877      .5575 
   emp_group |     1.568      .6933      .9472 |     1.568      .6933      .9471 
      safety |     1.514      .5753      1.071 |     1.514      .5753      1.071 
fearing_cr~e |     1.391      .4883      1.491 |     1.391      .4883      1.491 
       voted |     .7341      .1952      -1.06 |     .7341      .1952      -1.06 
discuss_po~s |     .8662      .4675      .1759 |     .8662      .4676      .1759 
police_sta~n |     .3651      .2319      .5602 |     .3651      .2319      .5604 
soldiers_a~y |     .1005     .09045      2.657 |     .1005     .09044      2.657 
 piped_water |     .5295      .2492     -.1183 |     .5295      .2492     -.1182 
r; t=0.72 15:21:38

. svyset [pweight = balance_zero]

Sampling weights: balance_zero
             VCE: linearized
     Single unit: missing
        Strata 1: <one>
 Sampling unit 1: <observations>
           FPC 1: <zero>
r; t=0.00 15:21:38

. 
. capture erase "${table}/t1_e.xls"
r; t=0.01 15:21:38

. capture erase "${table}/t1_e.rtf"
r; t=0.00 15:21:38

. estimates clear
r; t=0.00 15:21:38

. 
. * Make sure esttab / eststo / estadd are available
. cap which esttab
r; t=0.01 15:21:38

. if _rc ssc install estout, replace
r; t=0.00 15:21:38

. 
. local models
r; t=0.00 15:21:38

. 
. foreach k of varlist $zoutcomes_group1 {
  2.     
.     *--------------------------
.     * 1) Run model
.     *--------------------------
.     quietly svy: reg `k' i.time_zero $cvars i.cntrynum i.surveyyear
  3.     
.     *--------------------------
.     * 2) Control-group summary
.     *--------------------------
.     quietly summarize `k' if time_zero == 0
  4.     local m   = r(mean)
  5.     local min = r(min)
  6.     local max = r(max)
  7. 
.     *--------------------------
.     * 3) Short titles for table
.     *--------------------------
.     local short_title ""
  8.     if "`k'" == "zdemo_support"    local short_title "Support for democracy"
  9.     if "`k'" == "zauth_support"    local short_title "Reject authoritarianism"
 10.     if "`k'" == "zdemo_rated"      local short_title "Democracy rating"
 11. 
.     *--------------------------
.     * 4) Add custom stats to e()
.     *--------------------------
.     qui estadd scalar cmean = `m'
 12.     qui estadd scalar cmin  = `min'
 13.     qui estadd scalar cmax  = `max'
 14.     qui estadd local  pretreat "Yes"
 15. 
.     * Store model with nice title
.     eststo, title("`short_title'")
 16.     local models `"`models' `e(name)'"'
 17. }
(est1 stored)
(est2 stored)
(est3 stored)
r; t=0.42 15:21:39

. 
. *------------------------------------------
. * PRINT TABLE TO RESULTS WINDOW
. *------------------------------------------
. esttab `models', ///
>     keep(1.time_zero) ///
>     b(3) se level(95) brackets ///
>     star(* 0.05 ** 0.01 *** 0.001) ///
>     label nonotes noobs nobaselevels ///
>     coeflabels(1.time_zero "Terrorism exposure") ///
>     mtitle ///
>     stats(N r2 pretreat cmean, ///
>           fmt(0 3 0 3) ///
>           labels("Observations" "R^2" "Pre-treatment" "Control Mean" "Min" "Max")) ///
>     compress

-------------------------------------------------------
                       (1)          (2)          (3)   
                 Support~y    Reject ~m    Democra~g   
-------------------------------------------------------
Terrorism expo~e    -0.056***     0.010       -0.025** 
                   [0.013]      [0.009]      [0.008]   
-------------------------------------------------------
Observations          9148         9277         9046   
R^2                  0.072        0.124        0.089   
Pre-treatment          Yes          Yes          Yes   
Control Mean         0.762        0.818        0.533   
-------------------------------------------------------
r; t=0.06 15:21:39

. *-------------------------------*
. *Export CSV
. *-------------------------------*
. esttab `models' using "${table}/t1_entropybal.csv", replace csv ///
>     keep(1.time_zero) ///
>     coeflabels(1.time_zero "Terrorism exposure") ///
>     b(3) se level(95) brackets ///
>     star(* 0.05 ** 0.01 *** 0.001) ///
>     mtitle ///
>     label nonotes noobs nobaselevels ///
>     stats(N r2 pretreat cmean, ///
>           fmt(0 3 0 3) ///
>           labels("Observations" "R^2" "Pre-treatment" "Control mean" "Min" "Max")) ///
>     compress
(output written to /Users/souleymane.yameogo/Library/CloudStorage/Dropbox/WP3_OnlineCivics/Conflict proj
> ect/Conflict-Nigeria/Observationaldata/R9-Acled/JCR replication/output/tables/t1_entropybal.csv)
r; t=0.04 15:21:39

. ***************************************************************
. * 5. FIGURE 1 – LIBERAL DEMOCRACY vs HDI (COUNTRY MEANS)
. ***************************************************************
. 
. preserve
r; t=0.09 15:21:39

.   
.     capture confirm variable hdi
r; t=0.00 15:21:39

.     if _rc {
.         capture confirm variable HumanDevelopmentIndexHDI
r; t=0.00 15:21:39
.         if !_rc rename HumanDevelopmentIndexHDI hdi
r; t=0.00 15:21:39
.     }
r; t=0.00 15:21:39

. 
.     collapse (mean) v2x_libdem hdi, by(cntrynum)
r; t=0.14 15:21:39

. 
.     twoway scatter v2x_libdem hdi, ///
>         mlabel(cntrynum) mlabangle(45) mlabposition(12) mlabsize(vsmall) ///
>         msymbol(O) msize(vsmall) ///
>         xlabel(0.3(.1).8) ylabel(0(.1).6) ///
>         xtitle("Human Development Index (HDI)") ///
>         ytitle("Liberal Democracy Index (LDI)") ///
>         legend(off) aspect(0.8)
r; t=1.42 15:21:41

. 
.     graph save   "${graph}/vdemhdi.gph", replace
file /Users/souleymane.yameogo/Library/CloudStorage/Dropbox/WP3_OnlineCivics/Conflict project/Conflict-N
> igeria/Observationaldata/R9-Acled/JCR replication/output/graphs/vdemhdi.gph saved
r; t=0.17 15:21:41

.     graph export "${graph}/vdemhdi.eps", replace
file /Users/souleymane.yameogo/Library/CloudStorage/Dropbox/WP3_OnlineCivics/Conflict
    project/Conflict-Nigeria/Observationaldata/R9-Acled/JCR replication/output/graphs/vdemhdi.eps
    saved as EPS format
r; t=0.01 15:21:41

.     graph export "${graph}/vdemhdi.pdf", as(pdf) replace
file /Users/souleymane.yameogo/Library/CloudStorage/Dropbox/WP3_OnlineCivics/Conflict
    project/Conflict-Nigeria/Observationaldata/R9-Acled/JCR replication/output/graphs/vdemhdi.pdf
    saved as PDF format
r; t=0.04 15:21:41

.     graph export "${graph}/vdemhdi.png", width(2000) replace
file /Users/souleymane.yameogo/Library/CloudStorage/Dropbox/WP3_OnlineCivics/Conflict
    project/Conflict-Nigeria/Observationaldata/R9-Acled/JCR replication/output/graphs/vdemhdi.png
    saved as PNG format
r; t=0.28 15:21:41

. restore
r; t=0.04 15:21:41

. 
. ***************************************************************
. * 6. FIGURE 2 – MARGINAL EFFECT BY FATALITIES
. ***************************************************************
. 
. * Categorise fatalities
. capture drop fatalities_cat
r; t=0.00 15:21:41

. gen fatalities_cat = .
(10,201 missing values generated)
r; t=0.00 15:21:41

. replace fatalities_cat = 0 if fatalities == 0
(6,309 real changes made)
r; t=0.00 15:21:41

. replace fatalities_cat = 1 if inrange(fatalities, 1, 9)
(3,564 real changes made)
r; t=0.00 15:21:41

. replace fatalities_cat = 2 if fatalities >= 10
(328 real changes made)
r; t=0.00 15:21:41

. 
. label define fatalities_cat_lbl ///
>     0 "No (0)" ///
>     1 "Low (1–9)" ///
>     2 "High (10+)"
r; t=0.00 15:21:41

. label values fatalities_cat fatalities_cat_lbl
r; t=0.00 15:21:41

. label variable fatalities_cat "Fatalities category"
r; t=0.00 15:21:41

. tab fatalities_cat

 Fatalities |
   category |      Freq.     Percent        Cum.
------------+-----------------------------------
     No (0) |      6,309       61.85       61.85
  Low (1–9) |      3,564       34.94       96.78
 High (10+) |        328        3.22      100.00
------------+-----------------------------------
      Total |     10,201      100.00
r; t=0.00 15:21:41

. 
. foreach k of varlist $zoutcomes_group1 {
  2.     local title_label ""
  3.     if "`k'" == "zdemo_support" local title_label "Democratic support"
  4.     if "`k'" == "zauth_support" local title_label "Rejection of authoritarian alternatives"
  5.     if "`k'" == "zdemo_rated"  local title_label "Democracy rating"
  6. 
.     svy: reg `k' i.time_zero##i.fatalities_cat $cvars i.surveyyear
  7. 
.     margins, dydx(time_zero) at(fatalities_cat = (0(1)2))
  8.     marginsplot, ylabel(-.4(.1).4) xlabel(, labsize(medium)) yline(0) ///
>         xtitle("Fatalities", size(medium)) ///
>         ytitle("Effects of treatments on outcome", size(small)) ///
>         title("DV: `title_label'", size(medium)) ///
>         name(`k', replace) recastci(rspike) recast(scatter) ///
>         scale(.7) legend(off)
  9. }
(running regress on estimation sample)

Survey: Linear regression

Number of strata =     1                          Number of obs   =      9,148
Number of PSUs   = 9,148                          Population size = 11,857.036
                                                  Design df       =      9,147
                                                  F(21, 9127)     =      16.94
                                                  Prob > F        =     0.0000
                                                  R-squared       =     0.0379

------------------------------------------------------------------------------------------
                         |             Linearized
           zdemo_support | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-------------------------+----------------------------------------------------------------
             1.time_zero |  -.1078094   .0166015    -6.49   0.000     -.140352   -.0752668
                         |
          fatalities_cat |
              Low (1–9)  |  -.0238789   .0182594    -1.31   0.191    -.0596715    .0119136
             High (10+)  |   .1344599   .1120966     1.20   0.230    -.0852745    .3541943
                         |
time_zero#fatalities_cat |
            1#Low (1–9)  |    .055929   .0223672     2.50   0.012     .0120842    .0997738
           1#High (10+)  |   -.330326   .1156795    -2.86   0.004    -.5570837   -.1035683
                         |
                     age |   .0023647   .0003497     6.76   0.000     .0016793    .0030501
                  gender |   .0001844   .0108931     0.02   0.986    -.0211686    .0215374
              race_group |   -.008545   .0126409    -0.68   0.499     -.033324    .0162339
                religion |  -.0142392   .0052721    -2.70   0.007    -.0245737   -.0039046
                  ethnic |  -.0000564   .0000146    -3.87   0.000     -.000085   -.0000278
             urban_rural |   .0220962   .0130656     1.69   0.091    -.0035153    .0477077
              educ_group |   .0333358   .0069984     4.76   0.000     .0196174    .0470542
               emp_group |  -.0089462   .0069952    -1.28   0.201    -.0226583     .004766
                  safety |  -.0076673   .0088286    -0.87   0.385    -.0249732    .0096386
           fearing_crime |  -.0132885   .0093512    -1.42   0.155     -.031619     .005042
                   voted |   .0578645   .0135969     4.26   0.000     .0312116    .0845175
        discuss_politics |   .0057785   .0078293     0.74   0.460    -.0095686    .0211256
          police_station |  -.0037019   .0122486    -0.30   0.762    -.0277119    .0203082
           soldiers_army |  -.0164258   .0260257    -0.63   0.528    -.0674419    .0345904
             piped_water |   .0337656   .0119306     2.83   0.005     .0103791    .0571522
                         |
              surveyyear |
                   2022  |   .0233895   .0190797     1.23   0.220     -.014011      .06079
                         |
                   _cons |   .6421039   .0490643    13.09   0.000      .545927    .7382809
------------------------------------------------------------------------------------------

Average marginal effects

Number of strata =     1                          Number of obs   =      9,148
Number of PSUs   = 9,148                          Population size = 11,857.036
Model VCE: Linearized                             Design df       =      9,147

Expression: Linear prediction, predict()
dy/dx wrt:  1.time_zero
1._at: fatalities_cat = 0
2._at: fatalities_cat = 1
3._at: fatalities_cat = 2

------------------------------------------------------------------------------
             |            Delta-method
             |      dy/dx   std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
0.time_zero  |  (base outcome)
-------------+----------------------------------------------------------------
1.time_zero  |
         _at |
          1  |  -.1078094   .0166015    -6.49   0.000     -.140352   -.0752668
          2  |  -.0518804   .0169593    -3.06   0.002    -.0851245   -.0186363
          3  |  -.4381354   .1151444    -3.81   0.000    -.6638441   -.2124267
------------------------------------------------------------------------------
Note: dy/dx for factor levels is the discrete change from the base level.

Variables that uniquely identify margins: fatalities_cat
(running regress on estimation sample)

Survey: Linear regression

Number of strata =     1                          Number of obs   =      9,277
Number of PSUs   = 9,277                          Population size = 12,025.476
                                                  Design df       =      9,276
                                                  F(21, 9256)     =      45.27
                                                  Prob > F        =     0.0000
                                                  R-squared       =     0.0694

------------------------------------------------------------------------------------------
                         |             Linearized
           zauth_support | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-------------------------+----------------------------------------------------------------
             1.time_zero |  -.0513901   .0107501    -4.78   0.000    -.0724628   -.0303175
                         |
          fatalities_cat |
              Low (1–9)  |  -.0141368   .0118277    -1.20   0.232    -.0373217    .0090481
             High (10+)  |   .1728056   .0218845     7.90   0.000     .1299072     .215704
                         |
time_zero#fatalities_cat |
            1#Low (1–9)  |   .0318287   .0140614     2.26   0.024     .0042653    .0593921
           1#High (10+)  |  -.3302991   .0287667   -11.48   0.000    -.3866882   -.2739099
                         |
                     age |   .0010362   .0002278     4.55   0.000     .0005896    .0014828
                  gender |  -.0237696   .0066862    -3.56   0.000     -.036876   -.0106631
              race_group |  -.0048169   .0077095    -0.62   0.532    -.0199293    .0102954
                religion |    .003777    .003289     1.15   0.251    -.0026701    .0102242
                  ethnic |  -.0000191   9.21e-06    -2.07   0.039    -.0000371   -1.00e-06
             urban_rural |  -.0344064    .007717    -4.46   0.000    -.0495334   -.0192794
              educ_group |   .0476385   .0039106    12.18   0.000     .0399729    .0553041
               emp_group |    .008823   .0041265     2.14   0.033     .0007342    .0169117
                  safety |  -.0075268   .0053463    -1.41   0.159    -.0180068    .0029532
           fearing_crime |  -.0024287   .0057305    -0.42   0.672    -.0136618    .0088044
                   voted |   .0052431   .0080391     0.65   0.514    -.0105153    .0210015
        discuss_politics |   .0042265   .0048516     0.87   0.384    -.0052838    .0137367
          police_station |  -.0133414   .0076774    -1.74   0.082    -.0283907    .0017079
           soldiers_army |   -.000143   .0138843    -0.01   0.992    -.0273593    .0270733
             piped_water |   .0024197   .0073795     0.33   0.743    -.0120457    .0168852
                         |
              surveyyear |
                   2022  |  -.0123934   .0122056    -1.02   0.310    -.0363191    .0115322
                         |
                   _cons |   .7746309   .0282998    27.37   0.000     .7191571    .8301047
------------------------------------------------------------------------------------------

Average marginal effects

Number of strata =     1                          Number of obs   =      9,277
Number of PSUs   = 9,277                          Population size = 12,025.476
Model VCE: Linearized                             Design df       =      9,276

Expression: Linear prediction, predict()
dy/dx wrt:  1.time_zero
1._at: fatalities_cat = 0
2._at: fatalities_cat = 1
3._at: fatalities_cat = 2

------------------------------------------------------------------------------
             |            Delta-method
             |      dy/dx   std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
0.time_zero  |  (base outcome)
-------------+----------------------------------------------------------------
1.time_zero  |
         _at |
          1  |  -.0513901   .0107501    -4.78   0.000    -.0724628   -.0303175
          2  |  -.0195614   .0103704    -1.89   0.059    -.0398898    .0007669
          3  |  -.3816892   .0293069   -13.02   0.000    -.4391372   -.3242412
------------------------------------------------------------------------------
Note: dy/dx for factor levels is the discrete change from the base level.

Variables that uniquely identify margins: fatalities_cat
(running regress on estimation sample)

Survey: Linear regression

Number of strata =     1                           Number of obs   =     9,046
Number of PSUs   = 9,046                           Population size = 11,725.58
                                                   Design df       =     9,045
                                                   F(21, 9025)     =     13.00
                                                   Prob > F        =    0.0000
                                                   R-squared       =    0.0350

------------------------------------------------------------------------------------------
                         |             Linearized
             zdemo_rated | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-------------------------+----------------------------------------------------------------
             1.time_zero |  -.0449855   .0107361    -4.19   0.000    -.0660306   -.0239403
                         |
          fatalities_cat |
              Low (1–9)  |   .0013503   .0115701     0.12   0.907    -.0213297    .0240304
             High (10+)  |   .0607354   .0526056     1.15   0.248    -.0423834    .1638542
                         |
time_zero#fatalities_cat |
            1#Low (1–9)  |   .0572048   .0141327     4.05   0.000     .0295016    .0849081
           1#High (10+)  |   .0214672   .0551453     0.39   0.697      -.08663    .1295644
                         |
                     age |  -.0001572   .0002394    -0.66   0.511    -.0006266    .0003121
                  gender |   .0164708   .0066921     2.46   0.014     .0033528    .0295887
              race_group |  -.0029137   .0077753    -0.37   0.708    -.0181549    .0123276
                religion |   .0013988   .0035295     0.40   0.692    -.0055198    .0083174
                  ethnic |  -.0000341   7.71e-06    -4.42   0.000    -.0000492    -.000019
             urban_rural |    .001461   .0079644     0.18   0.854    -.0141511    .0170731
              educ_group |  -.0217182   .0042672    -5.09   0.000    -.0300829   -.0133536
               emp_group |   .0108115    .004317     2.50   0.012     .0023492    .0192739
                  safety |   -.034773   .0057566    -6.04   0.000    -.0460572   -.0234888
           fearing_crime |  -.0127243   .0061589    -2.07   0.039    -.0247972   -.0006514
                   voted |   .0280962   .0082307     3.41   0.001     .0119622    .0442301
        discuss_politics |    .006867   .0050025     1.37   0.170     -.002939    .0166729
          police_station |   .0161466   .0076667     2.11   0.035     .0011181    .0311751
           soldiers_army |  -.0179241   .0158342    -1.13   0.258    -.0489628    .0131145
             piped_water |   -.008157   .0074803    -1.09   0.276    -.0228201     .006506
                         |
              surveyyear |
                   2022  |   .0566458   .0125155     4.53   0.000     .0321126    .0811789
                         |
                   _cons |   .5876382   .0294671    19.94   0.000     .5298761    .6454004
------------------------------------------------------------------------------------------

Average marginal effects

Number of strata =     1                           Number of obs   =     9,046
Number of PSUs   = 9,046                           Population size = 11,725.58
Model VCE: Linearized                              Design df       =     9,045

Expression: Linear prediction, predict()
dy/dx wrt:  1.time_zero
1._at: fatalities_cat = 0
2._at: fatalities_cat = 1
3._at: fatalities_cat = 2

------------------------------------------------------------------------------
             |            Delta-method
             |      dy/dx   std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
0.time_zero  |  (base outcome)
-------------+----------------------------------------------------------------
1.time_zero  |
         _at |
          1  |  -.0449855   .0107361    -4.19   0.000    -.0660306   -.0239403
          2  |   .0122193   .0105559     1.16   0.247    -.0084726    .0329113
          3  |  -.0235183   .0552412    -0.43   0.670    -.1318034    .0847669
------------------------------------------------------------------------------
Note: dy/dx for factor levels is the discrete change from the base level.

Variables that uniquely identify margins: fatalities_cat
r; t=5.16 15:21:46

. 
. graph combine $zoutcomes_group1
r; t=2.20 15:21:48

. graph save   "${graph}/fatalities.gph", replace
file /Users/souleymane.yameogo/Library/CloudStorage/Dropbox/WP3_OnlineCivics/Conflict project/Conflict-N
> igeria/Observationaldata/R9-Acled/JCR replication/output/graphs/fatalities.gph saved
r; t=0.48 15:21:49

. graph export "${graph}/fatalities.eps", replace
file /Users/souleymane.yameogo/Library/CloudStorage/Dropbox/WP3_OnlineCivics/Conflict
    project/Conflict-Nigeria/Observationaldata/R9-Acled/JCR replication/output/graphs/fatalities.eps
    saved as EPS format
r; t=0.02 15:21:49

. graph export "${graph}/fatalities.pdf", as(pdf) replace
file /Users/souleymane.yameogo/Library/CloudStorage/Dropbox/WP3_OnlineCivics/Conflict
    project/Conflict-Nigeria/Observationaldata/R9-Acled/JCR replication/output/graphs/fatalities.pdf
    saved as PDF format
r; t=0.03 15:21:49

. graph export "${graph}/fatalities.png", width(2000) replace
file /Users/souleymane.yameogo/Library/CloudStorage/Dropbox/WP3_OnlineCivics/Conflict
    project/Conflict-Nigeria/Observationaldata/R9-Acled/JCR replication/output/graphs/fatalities.png
    saved as PNG format
r; t=0.34 15:21:49

. 
. ***************************************************************
. * 7. FIGURE 3 – MARGINAL EFFECT BY LDI (v2x_libdem)
. ***************************************************************
. 
. foreach k of varlist $zoutcomes_group1 {
  2.     local title_label ""
  3.     if "`k'" == "zdemo_support" local title_label "Democratic support"
  4.     if "`k'" == "zauth_support" local title_label "Rejection of authoritarian alternatives"
  5.     if "`k'" == "zdemo_rated"  local title_label "Democracy rating"
  6. 
.     svy: reg `k' i.time_zero##c.v2x_libdem $cvars i.surveyyear
  7. 
.     margins, dydx(time_zero) at(v2x_libdem = (0(0.1).7))
  8.     marginsplot, ylabel(-.4(.1).4) xlabel(, labsize(medium)) yline(0) ///
>         xtitle("Liberal democracy index score", size(medium)) ///
>         ytitle("Effects of treatments on outcome", size(small)) ///
>         title("DV: `title_label'", size(medium)) ///
>         name(`k', replace) recastci(rspike) recast(scatter) ///
>         scale(.8) legend(off)
  9. }
(running regress on estimation sample)

Survey: Linear regression

Number of strata =     1                          Number of obs   =      9,148
Number of PSUs   = 9,148                          Population size = 11,857.036
                                                  Design df       =      9,147
                                                  F(19, 9129)     =      16.37
                                                  Prob > F        =     0.0000
                                                  R-squared       =     0.0339

----------------------------------------------------------------------------------------
                       |             Linearized
         zdemo_support | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-----------------------+----------------------------------------------------------------
           1.time_zero |  -.0196359   .0330046    -0.59   0.552    -.0843324    .0450606
            v2x_libdem |   .2501102   .0739239     3.38   0.001     .1052029    .3950175
                       |
time_zero#c.v2x_libdem |
                    1  |  -.2133616   .0820286    -2.60   0.009     -.374156   -.0525671
                       |
                   age |   .0024804   .0003475     7.14   0.000     .0017992    .0031617
                gender |   .0002513   .0108744     0.02   0.982     -.021065    .0215676
            race_group |    .005534   .0123772     0.45   0.655    -.0187281     .029796
              religion |  -.0081348   .0054647    -1.49   0.137    -.0188469    .0025772
                ethnic |  -.0000499   .0000168    -2.97   0.003    -.0000828    -.000017
           urban_rural |   .0168765   .0130066     1.30   0.194    -.0086194    .0423723
            educ_group |   .0382436    .006991     5.47   0.000     .0245396    .0519476
             emp_group |  -.0091449   .0070222    -1.30   0.193      -.02291    .0046202
                safety |  -.0044276   .0087712    -0.50   0.614     -.021621    .0127659
         fearing_crime |  -.0137558   .0093049    -1.48   0.139    -.0319955    .0044839
                 voted |   .0530478   .0135943     3.90   0.000        .0264    .0796957
      discuss_politics |   .0013089   .0078144     0.17   0.867    -.0140092    .0166269
        police_station |  -.0034697   .0122383    -0.28   0.777    -.0274596    .0205202
         soldiers_army |  -.0096442   .0260725    -0.37   0.711    -.0607521    .0414637
           piped_water |    .022356   .0121677     1.84   0.066    -.0014954    .0462074
                       |
            surveyyear |
                 2022  |    .032074   .0188084     1.71   0.088    -.0047946    .0689425
                       |
                 _cons |   .4994794   .0595284     8.39   0.000     .3827904    .6161684
----------------------------------------------------------------------------------------

Average marginal effects

Number of strata =     1                          Number of obs   =      9,148
Number of PSUs   = 9,148                          Population size = 11,857.036
Model VCE: Linearized                             Design df       =      9,147

Expression: Linear prediction, predict()
dy/dx wrt:  1.time_zero
1._at: v2x_libdem =  0
2._at: v2x_libdem = .1
3._at: v2x_libdem = .2
4._at: v2x_libdem = .3
5._at: v2x_libdem = .4
6._at: v2x_libdem = .5
7._at: v2x_libdem = .6
8._at: v2x_libdem = .7

------------------------------------------------------------------------------
             |            Delta-method
             |      dy/dx   std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
0.time_zero  |  (base outcome)
-------------+----------------------------------------------------------------
1.time_zero  |
         _at |
          1  |  -.0196359   .0330046    -0.59   0.552    -.0843324    .0450606
          2  |  -.0409721   .0254767    -1.61   0.108    -.0909121     .008968
          3  |  -.0623082   .0185309    -3.36   0.001    -.0986329   -.0259835
          4  |  -.0836444   .0131262    -6.37   0.000    -.1093748    -.057914
          5  |  -.1049805   .0116523    -9.01   0.000    -.1278217   -.0821393
          6  |  -.1263167   .0152915    -8.26   0.000    -.1562914    -.096342
          7  |  -.1476529   .0215976    -6.84   0.000     -.189989   -.1053167
          8  |   -.168989   .0288731    -5.85   0.000    -.2255867   -.1123913
------------------------------------------------------------------------------
Note: dy/dx for factor levels is the discrete change from the base level.

Variables that uniquely identify margins: v2x_libdem
(running regress on estimation sample)

Survey: Linear regression

Number of strata =     1                          Number of obs   =      9,277
Number of PSUs   = 9,277                          Population size = 12,025.476
                                                  Design df       =      9,276
                                                  F(19, 9258)     =      27.69
                                                  Prob > F        =     0.0000
                                                  R-squared       =     0.0618

----------------------------------------------------------------------------------------
                       |             Linearized
         zauth_support | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-----------------------+----------------------------------------------------------------
           1.time_zero |  -.0078253   .0215999    -0.36   0.717    -.0501659    .0345153
            v2x_libdem |   .1353905   .0515958     2.62   0.009     .0342513    .2365297
                       |
time_zero#c.v2x_libdem |
                    1  |  -.1095265   .0539014    -2.03   0.042    -.2151851   -.0038678
                       |
                   age |    .001107   .0002276     4.86   0.000     .0006609    .0015531
                gender |  -.0233933   .0066958    -3.49   0.000    -.0365185   -.0102681
            race_group |   .0050579   .0073722     0.69   0.493    -.0093933    .0195091
              religion |   .0073263   .0033296     2.20   0.028     .0007996     .013853
                ethnic |  -.0000181   .0000109    -1.66   0.096    -.0000395    3.23e-06
           urban_rural |   -.038338   .0077956    -4.92   0.000    -.0536191   -.0230569
            educ_group |   .0509763   .0039501    12.91   0.000     .0432332    .0587193
             emp_group |   .0088462   .0041231     2.15   0.032      .000764    .0169284
                safety |  -.0053726   .0053588    -1.00   0.316    -.0158771    .0051319
         fearing_crime |  -.0027279   .0057306    -0.48   0.634    -.0139612    .0085054
                 voted |   .0031672    .008023     0.39   0.693    -.0125596    .0188941
      discuss_politics |   .0013166   .0048733     0.27   0.787    -.0082361    .0108693
        police_station |  -.0129672   .0076888    -1.69   0.092    -.0280389    .0021045
         soldiers_army |   .0056029    .013988     0.40   0.689    -.0218166    .0330224
           piped_water |  -.0052158    .007435    -0.70   0.483    -.0197901    .0093585
                       |
            surveyyear |
                 2022  |  -.0083269   .0117523    -0.71   0.479    -.0313639    .0147101
                       |
                 _cons |   .6961227   .0385398    18.06   0.000     .6205761    .7716692
----------------------------------------------------------------------------------------

Average marginal effects

Number of strata =     1                          Number of obs   =      9,277
Number of PSUs   = 9,277                          Population size = 12,025.476
Model VCE: Linearized                             Design df       =      9,276

Expression: Linear prediction, predict()
dy/dx wrt:  1.time_zero
1._at: v2x_libdem =  0
2._at: v2x_libdem = .1
3._at: v2x_libdem = .2
4._at: v2x_libdem = .3
5._at: v2x_libdem = .4
6._at: v2x_libdem = .5
7._at: v2x_libdem = .6
8._at: v2x_libdem = .7

------------------------------------------------------------------------------
             |            Delta-method
             |      dy/dx   std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
0.time_zero  |  (base outcome)
-------------+----------------------------------------------------------------
1.time_zero  |
         _at |
          1  |  -.0078253   .0215999    -0.36   0.717    -.0501659    .0345153
          2  |  -.0187779   .0166214    -1.13   0.259    -.0513596    .0138037
          3  |  -.0297306    .012004    -2.48   0.013     -.053261   -.0062002
          4  |  -.0406832   .0083681    -4.86   0.000    -.0570866   -.0242798
          5  |  -.0516359   .0073528    -7.02   0.000    -.0660489   -.0372228
          6  |  -.0625885   .0098086    -6.38   0.000    -.0818155   -.0433615
          7  |  -.0735412   .0140164    -5.25   0.000    -.1010165   -.0460659
          8  |  -.0844938   .0188367    -4.49   0.000    -.1214178   -.0475698
------------------------------------------------------------------------------
Note: dy/dx for factor levels is the discrete change from the base level.

Variables that uniquely identify margins: v2x_libdem
(running regress on estimation sample)

Survey: Linear regression

Number of strata =     1                           Number of obs   =     9,046
Number of PSUs   = 9,046                           Population size = 11,725.58
                                                   Design df       =     9,045
                                                   F(19, 9027)     =     23.07
                                                   Prob > F        =    0.0000
                                                   R-squared       =    0.0579

----------------------------------------------------------------------------------------
                       |             Linearized
           zdemo_rated | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-----------------------+----------------------------------------------------------------
           1.time_zero |  -.0096351   .0224987    -0.43   0.668    -.0537378    .0344675
            v2x_libdem |   .4660318   .0513074     9.08   0.000     .3654577     .566606
                       |
time_zero#c.v2x_libdem |
                    1  |  -.0346947   .0558293    -0.62   0.534    -.1441328    .0747434
                       |
                   age |  -.0000327    .000234    -0.14   0.889    -.0004914    .0004259
                gender |   .0152506    .006671     2.29   0.022      .002174    .0283273
            race_group |    .001148    .007999     0.14   0.886    -.0145319    .0168278
              religion |   .0152062    .003621     4.20   0.000     .0081082    .0223043
                ethnic |   .0000457   .0000101     4.53   0.000     .0000259    .0000655
           urban_rural |   .0124319   .0080066     1.55   0.121    -.0032629    .0281267
            educ_group |  -.0163117   .0042857    -3.81   0.000    -.0247126   -.0079107
             emp_group |   .0030677   .0044334     0.69   0.489    -.0056227    .0117581
                safety |  -.0312612   .0055844    -5.60   0.000     -.042208   -.0203145
         fearing_crime |  -.0129419   .0060661    -2.13   0.033    -.0248329    -.001051
                 voted |    .014743     .00817     1.80   0.071     -.001272     .030758
      discuss_politics |   .0035841   .0050227     0.71   0.476    -.0062616    .0134298
        police_station |   .0137429    .007649     1.80   0.072    -.0012509    .0287366
         soldiers_army |   .0204514   .0157784     1.30   0.195    -.0104779    .0513807
           piped_water |   -.023528   .0075262    -3.13   0.002    -.0382812   -.0087749
                       |
            surveyyear |
                 2022  |    .057279   .0117594     4.87   0.000      .034228    .0803301
                       |
                 _cons |   .3147731   .0379367     8.30   0.000     .2404087    .3891375
----------------------------------------------------------------------------------------

Average marginal effects

Number of strata =     1                           Number of obs   =     9,046
Number of PSUs   = 9,046                           Population size = 11,725.58
Model VCE: Linearized                              Design df       =     9,045

Expression: Linear prediction, predict()
dy/dx wrt:  1.time_zero
1._at: v2x_libdem =  0
2._at: v2x_libdem = .1
3._at: v2x_libdem = .2
4._at: v2x_libdem = .3
5._at: v2x_libdem = .4
6._at: v2x_libdem = .5
7._at: v2x_libdem = .6
8._at: v2x_libdem = .7

------------------------------------------------------------------------------
             |            Delta-method
             |      dy/dx   std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
0.time_zero  |  (base outcome)
-------------+----------------------------------------------------------------
1.time_zero  |
         _at |
          1  |  -.0096351   .0224987    -0.43   0.668    -.0537378    .0344675
          2  |  -.0131046    .017315    -0.76   0.449    -.0470459    .0208367
          3  |  -.0165741   .0124805    -1.33   0.184    -.0410387    .0078905
          4  |  -.0200435   .0086055    -2.33   0.020    -.0369123   -.0031748
          5  |   -.023513   .0073949    -3.18   0.001    -.0380087   -.0090173
          6  |  -.0269825    .009882    -2.73   0.006    -.0463533   -.0076116
          7  |   -.030452   .0142464    -2.14   0.033    -.0583781   -.0025258
          8  |  -.0339214   .0192511    -1.76   0.078    -.0716579    .0038151
------------------------------------------------------------------------------
Note: dy/dx for factor levels is the discrete change from the base level.

Variables that uniquely identify margins: v2x_libdem
r; t=7.04 15:21:56

. 
. graph combine $zoutcomes_group1
r; t=2.02 15:21:58

. graph save   "${graph}/libdem.gph", replace
file /Users/souleymane.yameogo/Library/CloudStorage/Dropbox/WP3_OnlineCivics/Conflict project/Conflict-N
> igeria/Observationaldata/R9-Acled/JCR replication/output/graphs/libdem.gph saved
r; t=0.45 15:21:59

. graph export "${graph}/libdem.eps", replace
file /Users/souleymane.yameogo/Library/CloudStorage/Dropbox/WP3_OnlineCivics/Conflict
    project/Conflict-Nigeria/Observationaldata/R9-Acled/JCR replication/output/graphs/libdem.eps saved
    as EPS format
r; t=0.03 15:21:59

. graph export "${graph}/libdem.pdf", as(pdf) replace
file /Users/souleymane.yameogo/Library/CloudStorage/Dropbox/WP3_OnlineCivics/Conflict
    project/Conflict-Nigeria/Observationaldata/R9-Acled/JCR replication/output/graphs/libdem.pdf saved
    as PDF format
r; t=0.07 15:21:59

. 
. ***************************************************************
. * 8. FIGURE 4 – MARGINAL EFFECT BY HDI
. ***************************************************************
. 
. foreach k of varlist $zoutcomes_group1 {
  2.     local title_label ""
  3.     if "`k'" == "zdemo_support" local title_label "Democratic support"
  4.     if "`k'" == "zauth_support" local title_label "Rejection of authoritarian alternatives"
  5.     if "`k'" == "zdemo_rated"  local title_label "Democracy rating"
  6. 
.     svy: reg `k' i.time_zero##c.hdi $cvars i.surveyyear
  7. 
.     margins, dydx(time_zero) at(hdi = (0.3(0.1).7))
  8.     marginsplot, ylabel(-.3(.1).3) xlabel(, labsize(medium)) yline(0) ///
>         xtitle("Human development index score", size(medium)) ///
>         ytitle("Effects of treatments on outcome", size(medsmall)) ///
>         title("DV: `title_label'", size(medium)) ///
>         name(`k', replace) recastci(rspike) recast(scatter) ///
>         scale(.8) legend(off)
  9. }
(running regress on estimation sample)

Survey: Linear regression

Number of strata =     1                          Number of obs   =      9,148
Number of PSUs   = 9,148                          Population size = 11,857.036
                                                  Design df       =      9,147
                                                  F(19, 9129)     =      17.90
                                                  Prob > F        =     0.0000
                                                  R-squared       =     0.0360

----------------------------------------------------------------------------------
                 |             Linearized
   zdemo_support | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-----------------+----------------------------------------------------------------
     1.time_zero |  -.3414429    .080792    -4.23   0.000    -.4998132   -.1830726
             hdi |   .1146107   .1624678     0.71   0.481    -.2038624    .4330838
                 |
 time_zero#c.hdi |
              1  |   .4521383   .1530486     2.95   0.003     .1521288    .7521478
                 |
             age |   .0024017   .0003471     6.92   0.000     .0017213     .003082
          gender |  -.0017962   .0109785    -0.16   0.870    -.0233166    .0197242
      race_group |  -.0319198   .0160864    -1.98   0.047    -.0634528   -.0003868
        religion |  -.0218006   .0056846    -3.84   0.000    -.0329437   -.0106575
          ethnic |  -.0000658   .0000146    -4.51   0.000    -.0000944   -.0000372
     urban_rural |   .0261607   .0129273     2.02   0.043     .0008203    .0515011
      educ_group |   .0307651   .0072076     4.27   0.000     .0166366    .0448935
       emp_group |  -.0121866   .0071275    -1.71   0.087    -.0261581     .001785
          safety |  -.0032502   .0088183    -0.37   0.712    -.0205361    .0140356
   fearing_crime |  -.0139095   .0093628    -1.49   0.137    -.0322627    .0044437
           voted |   .0571315   .0136355     4.19   0.000      .030403    .0838601
discuss_politics |   .0046512   .0078073     0.60   0.551    -.0106528    .0199552
  police_station |  -.0028237   .0122692    -0.23   0.818    -.0268741    .0212268
   soldiers_army |   -.020168    .025234    -0.80   0.424    -.0696323    .0292964
     piped_water |   .0292602   .0118183     2.48   0.013     .0060937    .0524267
                 |
      surveyyear |
           2022  |   .0286709   .0216363     1.33   0.185     -.013741    .0710828
                 |
           _cons |   .6140501   .0952706     6.45   0.000     .4272984    .8008018
----------------------------------------------------------------------------------

Average marginal effects

Number of strata =     1                          Number of obs   =      9,148
Number of PSUs   = 9,148                          Population size = 11,857.036
Model VCE: Linearized                             Design df       =      9,147

Expression: Linear prediction, predict()
dy/dx wrt:  1.time_zero
1._at: hdi = .3
2._at: hdi = .4
3._at: hdi = .5
4._at: hdi = .6
5._at: hdi = .7

------------------------------------------------------------------------------
             |            Delta-method
             |      dy/dx   std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
0.time_zero  |  (base outcome)
-------------+----------------------------------------------------------------
1.time_zero  |
         _at |
          1  |  -.2058014   .0359567    -5.72   0.000    -.2762846   -.1353182
          2  |  -.1605876   .0220232    -7.29   0.000     -.203758   -.1174171
          3  |  -.1153738    .012068    -9.56   0.000    -.1390298   -.0917177
          4  |  -.0701599    .016575    -4.23   0.000    -.1026505   -.0376693
          5  |  -.0249461   .0295347    -0.84   0.398    -.0828407    .0329485
------------------------------------------------------------------------------
Note: dy/dx for factor levels is the discrete change from the base level.

Variables that uniquely identify margins: hdi
(running regress on estimation sample)

Survey: Linear regression

Number of strata =     1                          Number of obs   =      9,277
Number of PSUs   = 9,277                          Population size = 12,025.476
                                                  Design df       =      9,276
                                                  F(19, 9258)     =      31.38
                                                  Prob > F        =     0.0000
                                                  R-squared       =     0.0659

----------------------------------------------------------------------------------
                 |             Linearized
   zauth_support | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-----------------+----------------------------------------------------------------
     1.time_zero |  -.1616069   .0475285    -3.40   0.001    -.2547731   -.0684406
             hdi |   .2317081   .0948118     2.44   0.015     .0458561    .4175601
                 |
 time_zero#c.hdi |
              1  |   .2090164   .0892658     2.34   0.019     .0340358    .3839969
                 |
             age |   .0010176   .0002277     4.47   0.000     .0005713    .0014638
          gender |  -.0253665   .0067385    -3.76   0.000    -.0385755   -.0121575
      race_group |  -.0299079   .0097216    -3.08   0.002    -.0489643   -.0108514
        religion |  -.0036808    .003525    -1.04   0.296    -.0105906    .0032291
          ethnic |  -.0000262   9.17e-06    -2.85   0.004    -.0000441   -8.20e-06
     urban_rural |   -.031104   .0077412    -4.02   0.000    -.0462784   -.0159296
      educ_group |   .0447902    .004086    10.96   0.000     .0367808    .0527997
       emp_group |   .0056253   .0041684     1.35   0.177    -.0025457    .0137964
          safety |   -.004365   .0053916    -0.81   0.418    -.0149337    .0062038
   fearing_crime |  -.0030904   .0057626    -0.54   0.592    -.0143864    .0082056
           voted |   .0075539   .0079929     0.95   0.345    -.0081139    .0232217
discuss_politics |    .003637    .004872     0.75   0.455    -.0059132    .0131872
  police_station |   -.011949    .007684    -1.56   0.120    -.0270113    .0031133
   soldiers_army |  -.0025544   .0137106    -0.19   0.852    -.0294302    .0243215
     piped_water |  -.0029187   .0073202    -0.40   0.690     -.017268    .0114306
                 |
      surveyyear |
           2022  |   .0022701    .013326     0.17   0.865    -.0238518     .028392
                 |
           _cons |   .6834752   .0556778    12.28   0.000     .5743345    .7926159
----------------------------------------------------------------------------------

Average marginal effects

Number of strata =     1                          Number of obs   =      9,277
Number of PSUs   = 9,277                          Population size = 12,025.476
Model VCE: Linearized                             Design df       =      9,276

Expression: Linear prediction, predict()
dy/dx wrt:  1.time_zero
1._at: hdi = .3
2._at: hdi = .4
3._at: hdi = .5
4._at: hdi = .6
5._at: hdi = .7

------------------------------------------------------------------------------
             |            Delta-method
             |      dy/dx   std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
0.time_zero  |  (base outcome)
-------------+----------------------------------------------------------------
1.time_zero  |
         _at |
          1  |   -.098902   .0214692    -4.61   0.000    -.1409862   -.0568177
          2  |  -.0780003   .0134282    -5.81   0.000    -.1043225   -.0516781
          3  |  -.0570987   .0076861    -7.43   0.000    -.0721651   -.0420323
          4  |   -.036197   .0098591    -3.67   0.000    -.0555231    -.016871
          5  |  -.0152954   .0171667    -0.89   0.373     -.048946    .0183552
------------------------------------------------------------------------------
Note: dy/dx for factor levels is the discrete change from the base level.

Variables that uniquely identify margins: hdi
(running regress on estimation sample)

Survey: Linear regression

Number of strata =     1                           Number of obs   =     9,046
Number of PSUs   = 9,046                           Population size = 11,725.58
                                                   Design df       =     9,045
                                                   F(19, 9027)     =     12.14
                                                   Prob > F        =    0.0000
                                                   R-squared       =    0.0331

----------------------------------------------------------------------------------
                 |             Linearized
     zdemo_rated | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-----------------+----------------------------------------------------------------
     1.time_zero |  -.1882435   .0463732    -4.06   0.000    -.2791454   -.0973415
             hdi |   .0101124   .0900251     0.11   0.911    -.1663573     .186582
                 |
 time_zero#c.hdi |
              1  |   .2996061   .0869778     3.44   0.001     .1291099    .4701023
                 |
             age |  -.0002086   .0002401    -0.87   0.385    -.0006792     .000262
          gender |    .014974   .0067309     2.22   0.026     .0017799    .0281681
      race_group |  -.0248838   .0096795    -2.57   0.010    -.0438577   -.0059098
        religion |  -.0035433    .003724    -0.95   0.341    -.0108432    .0037565
          ethnic |  -.0000261   7.76e-06    -3.36   0.001    -.0000413   -.0000109
     urban_rural |   .0078446   .0078996     0.99   0.321    -.0076405    .0233297
      educ_group |  -.0250566   .0044237    -5.66   0.000    -.0337281   -.0163851
       emp_group |   .0077868   .0043746     1.78   0.075    -.0007884    .0163621
          safety |   -.034042   .0057573    -5.91   0.000    -.0453276   -.0227563
   fearing_crime |  -.0126509   .0061472    -2.06   0.040    -.0247008   -.0006011
           voted |   .0267366   .0081936     3.26   0.001     .0106754    .0427978
discuss_politics |   .0075467   .0049903     1.51   0.130    -.0022354    .0173288
  police_station |   .0157733   .0077001     2.05   0.041     .0006794    .0308673
   soldiers_army |  -.0134942   .0155525    -0.87   0.386    -.0439806    .0169921
     piped_water |   -.010577   .0074089    -1.43   0.153    -.0251001    .0039461
                 |
      surveyyear |
           2022  |    .054678   .0129665     4.22   0.000     .0292607    .0800952
                 |
           _cons |   .6181462   .0539469    11.46   0.000     .5123981    .7238943
----------------------------------------------------------------------------------

Average marginal effects

Number of strata =     1                           Number of obs   =     9,046
Number of PSUs   = 9,046                           Population size = 11,725.58
Model VCE: Linearized                              Design df       =     9,045

Expression: Linear prediction, predict()
dy/dx wrt:  1.time_zero
1._at: hdi = .3
2._at: hdi = .4
3._at: hdi = .5
4._at: hdi = .6
5._at: hdi = .7

------------------------------------------------------------------------------
             |            Delta-method
             |      dy/dx   std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
0.time_zero  |  (base outcome)
-------------+----------------------------------------------------------------
1.time_zero  |
         _at |
          1  |  -.0983616   .0210438    -4.67   0.000    -.1396123    -.057111
          2  |   -.068401   .0132755    -5.15   0.000    -.0944239   -.0423781
          3  |  -.0384404   .0078062    -4.92   0.000    -.0537423   -.0231385
          4  |  -.0084798   .0098457    -0.86   0.389    -.0277797    .0108201
          5  |   .0214808   .0168595     1.27   0.203    -.0115676    .0545293
------------------------------------------------------------------------------
Note: dy/dx for factor levels is the discrete change from the base level.

Variables that uniquely identify margins: hdi
r; t=6.37 15:22:05

. 
. graph combine $zoutcomes_group1
r; t=1.93 15:22:07

. graph save   "${graph}/hdi.gph", replace
file /Users/souleymane.yameogo/Library/CloudStorage/Dropbox/WP3_OnlineCivics/Conflict project/Conflict-N
> igeria/Observationaldata/R9-Acled/JCR replication/output/graphs/hdi.gph saved
r; t=0.44 15:22:08

. graph export "${graph}/hdi.eps", replace
file /Users/souleymane.yameogo/Library/CloudStorage/Dropbox/WP3_OnlineCivics/Conflict
    project/Conflict-Nigeria/Observationaldata/R9-Acled/JCR replication/output/graphs/hdi.eps saved as
    EPS format
r; t=0.02 15:22:08

. graph export "${graph}/hdi.pdf", as(pdf) replace
file /Users/souleymane.yameogo/Library/CloudStorage/Dropbox/WP3_OnlineCivics/Conflict
    project/Conflict-Nigeria/Observationaldata/R9-Acled/JCR replication/output/graphs/hdi.pdf saved as
    PDF format
r; t=0.05 15:22:08

. 
. ***************************************************************
. * 9. FIGURE 5 – HETEROGENEITY BY GENDER
. ***************************************************************
. 
. svyset, clear
r; t=0.00 15:22:08

. global cvar_gender age race_group religion ethnic urban_rural educ_group emp_group ///
>                    safety fearing_crime voted discuss_politics ///
>                    police_station soldiers_army piped_water 
r; t=0.00 15:22:08

. 
. *drop balance_gender
. ebalance time_zero $cvar_gender, generate(balance_gender) targets(3)


Data Setup
Treatment variable:   time_zero
Covariate adjustment: age race_group religion ethnic urban_rural educ_group emp_group safety fearing_cri
> me voted discuss_politics police_station soldiers_army piped_water (1st order). age race_group religio
> n ethnic urban_rural educ_group emp_group safety fearing_crime voted discuss_politics police_station s
> oldiers_army piped_water (2nd order). age race_group religion ethnic urban_rural educ_group emp_group 
> safety fearing_crime voted discuss_politics police_station soldiers_army piped_water (3rd order).


Optimizing...
Iteration 1: Max Difference = 22351.177
Iteration 2: Max Difference = 8220.52483
Iteration 3: Max Difference = 3022.14949
Iteration 4: Max Difference = 1109.77703
Iteration 5: Max Difference = 406.262527
Iteration 6: Max Difference = 147.475668
Iteration 7: Max Difference = 52.3312525
Iteration 8: Max Difference = 17.479128
Iteration 9: Max Difference = 4.99951036
Iteration 10: Max Difference = .990557483
Iteration 11: Max Difference = .087975691
Iteration 12: Max Difference = .001208454
maximum difference smaller than the tolerance level; convergence achieved


Treated units: 6047    total of weights: 6047
Control units: 3285    total of weights: 6047


Before: without weighting

             |              Treat              |             Control             
             |      mean   variance   skewness |      mean   variance   skewness 
-------------+---------------------------------+--------------------------------
         age |     38.77      210.3      .7741 |     39.49      223.4      .7352 
  race_group |     1.191      .3344      2.753 |     1.129      .2393      3.539 
    religion |     1.851      1.051      1.173 |     1.976      1.043      1.001 
      ethnic |     762.3     254093      .5954 |     680.6     260394      .6825 
 urban_rural |     1.559      .2466     -.2361 |     1.661       .224     -.6825 
  educ_group |     1.979       .877      .5577 |      1.95      .8321      .4651 
   emp_group |     1.568      .6933      .9472 |      1.52      .6559      1.083 
      safety |     1.514      .5753      1.071 |     1.441      .5116      1.293 
fearing_cr~e |     1.391      .4883      1.491 |     1.358      .4625      1.634 
       voted |     .7341      .1952      -1.06 |      .783        .17     -1.373 
discuss_po~s |     .8662      .4675      .1759 |     .8533      .5028       .218 
police_sta~n |     .3651      .2319      .5602 |     .3169      .2165      .7871 
soldiers_a~y |     .1005     .09045      2.657 |     .0347     .03351      5.084 
 piped_water |     .5295      .2492     -.1183 |     .4581      .2483       .168 


After:  balance_gender as the weighting variable

             |              Treat              |             Control             
             |      mean   variance   skewness |      mean   variance   skewness 
-------------+---------------------------------+--------------------------------
         age |     38.77      210.3      .7741 |     38.77      210.3      .7739 
  race_group |     1.191      .3344      2.753 |     1.191      .3344      2.753 
    religion |     1.851      1.051      1.173 |     1.851      1.051      1.173 
      ethnic |     762.3     254093      .5954 |     762.3     254118      .5954 
 urban_rural |     1.559      .2466     -.2361 |     1.559      .2466     -.2364 
  educ_group |     1.979       .877      .5577 |     1.979       .877      .5575 
   emp_group |     1.568      .6933      .9472 |     1.568      .6933      .9472 
      safety |     1.514      .5753      1.071 |     1.514      .5753      1.071 
fearing_cr~e |     1.391      .4883      1.491 |     1.391      .4883      1.491 
       voted |     .7341      .1952      -1.06 |     .7341      .1952      -1.06 
discuss_po~s |     .8662      .4675      .1759 |     .8662      .4676      .1759 
police_sta~n |     .3651      .2319      .5602 |     .3651      .2319      .5604 
soldiers_a~y |     .1005     .09045      2.657 |     .1005     .09044      2.657 
 piped_water |     .5295      .2492     -.1183 |     .5295      .2492     -.1182 
r; t=0.61 15:22:08

. svyset [pweight = balance_gender]

Sampling weights: balance_gender
             VCE: linearized
     Single unit: missing
        Strata 1: <one>
 Sampling unit 1: <observations>
           FPC 1: <zero>
r; t=0.00 15:22:08

. 
. foreach k of varlist $zoutcomes_group1 {
  2.     local title_label ""
  3.     if "`k'" == "zdemo_support" local title_label "Democratic support"
  4.     if "`k'" == "zauth_support" local title_label "Rejection of authoritarian alternatives"
  5.     if "`k'" == "zdemo_rated"  local title_label "Democracy rating"
  6. 
.     svy: reg `k' i.time_zero##i.gender $cvar_gender i.surveyyear i.cntrynum
  7.     margins, dydx(time_zero) at(gender = (0 1))
  8. 
.     marginsplot, ylabel(-.2(.05).2) xlabel(, labsize(medium)) yline(0) ///
>         xtitle("Gender", size(medium)) ///
>         ytitle("Effects of treatments on outcome", size(small)) ///
>         title("DV: `title_label'", size(medium)) ///
>         name(`k', replace) recastci(rspike) recast(scatter) ///
>         scale(.8) legend(off)
  9. }
(running regress on estimation sample)

Survey: Linear regression

Number of strata =     1                          Number of obs   =      9,148
Number of PSUs   = 9,148                          Population size = 11,856.435
                                                  Design df       =      9,147
                                                  F(29, 9119)     =      23.53
                                                  Prob > F        =     0.0000
                                                  R-squared       =     0.0724

----------------------------------------------------------------------------------
                 |             Linearized
   zdemo_support | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-----------------+----------------------------------------------------------------
     1.time_zero |  -.0446556   .0170761    -2.62   0.009    -.0781285   -.0111827
                 |
          gender |
         Female  |   .0031985   .0169815     0.19   0.851    -.0300889     .036486
                 |
time_zero#gender |
       1#Female  |  -.0232316   .0201189    -1.15   0.248    -.0626691    .0162059
                 |
             age |   .0018657   .0003492     5.34   0.000     .0011811    .0025503
      race_group |   .0470745   .0403066     1.17   0.243    -.0319355    .1260844
        religion |  -.0095637   .0062374    -1.53   0.125    -.0217904    .0026631
          ethnic |   1.51e-06   .0000326     0.05   0.963    -.0000624    .0000654
     urban_rural |   .0316034   .0129072     2.45   0.014     .0063025    .0569044
      educ_group |   .0272996   .0071155     3.84   0.000     .0133517    .0412476
       emp_group |  -.0138698   .0070754    -1.96   0.050    -.0277391   -4.90e-07
          safety |   -.000178   .0086371    -0.02   0.984    -.0171086    .0167526
   fearing_crime |    -.00641   .0090563    -0.71   0.479    -.0241624    .0113425
           voted |   .0454217   .0135032     3.36   0.001     .0189524     .071891
discuss_politics |   .0008271   .0075418     0.11   0.913    -.0139565    .0156106
  police_station |   .0033315   .0120168     0.28   0.782    -.0202241    .0268872
   soldiers_army |   .0157685   .0281978     0.56   0.576    -.0395054    .0710425
     piped_water |   .0138039   .0120601     1.14   0.252    -.0098366    .0374444
                 |
      surveyyear |
           2022  |  -.2846884   .0642921    -4.43   0.000    -.4107152   -.1586616
                 |
        cntrynum |
          Benin  |   .3123415    .069798     4.47   0.000     .1755218    .4491612
   Burkina Faso  |   .0387897   .0700241     0.55   0.580    -.0984732    .1760527
       Cameroon  |    .102574   .0542744     1.89   0.059     -.003816    .2089641
          Ghana  |   .2879258   .0656704     4.38   0.000     .1591972    .4166544
         Guinea  |   .3102479   .0544713     5.70   0.000      .203472    .4170237
          Kenya  |          0  (omitted)
        Morocco  |   .1288742   .0922013     1.40   0.162     -.051861    .3096094
          Niger  |   .1348369    .051164     2.64   0.008      .034544    .2351297
        Senegal  |   .4012561   .0585493     6.85   0.000     .2864864    .5160258
   Sierra Leone  |   .3153762   .0543031     5.81   0.000       .20893    .4218224
       Tanzania  |   .3178616   .0548477     5.80   0.000     .2103479    .4253753
       Zimbabwe  |   .3022206   .0537945     5.62   0.000     .1967713      .40767
                 |
           _cons |   .5740499   .0651914     8.81   0.000     .4462603    .7018396
----------------------------------------------------------------------------------

Average marginal effects

Number of strata =     1                          Number of obs   =      9,148
Number of PSUs   = 9,148                          Population size = 11,856.435
Model VCE: Linearized                             Design df       =      9,147

Expression: Linear prediction, predict()
dy/dx wrt:  1.time_zero
1._at: gender = 0
2._at: gender = 1

------------------------------------------------------------------------------
             |            Delta-method
             |      dy/dx   std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
0.time_zero  |  (base outcome)
-------------+----------------------------------------------------------------
1.time_zero  |
         _at |
          1  |  -.0446556   .0170761    -2.62   0.009    -.0781285   -.0111827
          2  |  -.0678872   .0162731    -4.17   0.000    -.0997862   -.0359882
------------------------------------------------------------------------------
Note: dy/dx for factor levels is the discrete change from the base level.

Variables that uniquely identify margins: gender
(running regress on estimation sample)

Survey: Linear regression

Number of strata =     1                          Number of obs   =      9,277
Number of PSUs   = 9,277                          Population size = 12,025.356
                                                  Design df       =      9,276
                                                  F(29, 9248)     =      39.31
                                                  Prob > F        =     0.0000
                                                  R-squared       =     0.1247

----------------------------------------------------------------------------------
                 |             Linearized
   zauth_support | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-----------------+----------------------------------------------------------------
     1.time_zero |  -.0008077   .0102272    -0.08   0.937    -.0208552    .0192398
                 |
          gender |
         Female  |  -.0392892   .0103659    -3.79   0.000    -.0596085   -.0189698
                 |
time_zero#gender |
       1#Female  |   .0226706   .0122735     1.85   0.065    -.0013883    .0467294
                 |
             age |   .0008094   .0002263     3.58   0.000     .0003657    .0012531
      race_group |   .0774236    .025604     3.02   0.003     .0272342    .1276131
        religion |   .0016313   .0036663     0.44   0.656    -.0055555    .0088181
          ethnic |   .0000412    .000024     1.72   0.086    -5.81e-06    .0000882
     urban_rural |  -.0112538   .0077951    -1.44   0.149    -.0265338    .0040263
      educ_group |   .0434336   .0040667    10.68   0.000     .0354621    .0514052
       emp_group |     .00445   .0041029     1.08   0.278    -.0035927    .0124926
          safety |  -.0015405    .005257    -0.29   0.770    -.0118454    .0087644
   fearing_crime |  -.0005377   .0055595    -0.10   0.923    -.0114356    .0103602
           voted |  -.0048023   .0079627    -0.60   0.546    -.0204109    .0108063
discuss_politics |   .0027851   .0047578     0.59   0.558    -.0065412    .0121114
  police_station |  -.0031797   .0074074    -0.43   0.668    -.0176999    .0113405
   soldiers_army |   .0131016   .0153947     0.85   0.395    -.0170755    .0432787
     piped_water |   .0022876    .007249     0.32   0.752    -.0119221    .0164972
                 |
      surveyyear |
           2022  |   -.088242    .041627    -2.12   0.034    -.1698401    -.006644
                 |
        cntrynum |
          Benin  |   .1124649    .046217     2.43   0.015     .0218695    .2030603
   Burkina Faso  |  -.1272322   .0460352    -2.76   0.006    -.2174713    -.036993
       Cameroon  |  -.1155421   .0318314    -3.63   0.000    -.1779386   -.0531455
          Ghana  |   .0466534   .0430479     1.08   0.279    -.0377299    .1310367
         Guinea  |   .0620069   .0345731     1.79   0.073     -.005764    .1297778
          Kenya  |          0  (omitted)
        Morocco  |  -.1809463   .0563252    -3.21   0.001     -.291356   -.0705366
          Niger  |  -.1305591   .0302434    -4.32   0.000    -.1898427   -.0712754
        Senegal  |   .1030379   .0368138     2.80   0.005     .0308747    .1752012
   Sierra Leone  |     .11676   .0309727     3.77   0.000     .0560467    .1774733
       Tanzania  |   .0300793   .0339088     0.89   0.375    -.0363893    .0965479
       Zimbabwe  |   .0058353   .0341415     0.17   0.864    -.0610896    .0727603
                 |
           _cons |   .6628819   .0391405    16.94   0.000     .5861579    .7396058
----------------------------------------------------------------------------------

Average marginal effects

Number of strata =     1                          Number of obs   =      9,277
Number of PSUs   = 9,277                          Population size = 12,025.356
Model VCE: Linearized                             Design df       =      9,276

Expression: Linear prediction, predict()
dy/dx wrt:  1.time_zero
1._at: gender = 0
2._at: gender = 1

------------------------------------------------------------------------------
             |            Delta-method
             |      dy/dx   std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
0.time_zero  |  (base outcome)
-------------+----------------------------------------------------------------
1.time_zero  |
         _at |
          1  |  -.0008077   .0102272    -0.08   0.937    -.0208552    .0192398
          2  |   .0218628   .0112824     1.94   0.053    -.0002532    .0439789
------------------------------------------------------------------------------
Note: dy/dx for factor levels is the discrete change from the base level.

Variables that uniquely identify margins: gender
(running regress on estimation sample)

Survey: Linear regression

Number of strata =     1                          Number of obs   =      9,046
Number of PSUs   = 9,046                          Population size = 11,724.864
                                                  Design df       =      9,045
                                                  F(29, 9017)     =      24.16
                                                  Prob > F        =     0.0000
                                                  R-squared       =     0.0888

----------------------------------------------------------------------------------
                 |             Linearized
     zdemo_rated | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-----------------+----------------------------------------------------------------
     1.time_zero |  -.0313567   .0106489    -2.94   0.003     -.052231   -.0104824
                 |
          gender |
         Female  |    .005787   .0107536     0.54   0.590    -.0152925    .0268665
                 |
time_zero#gender |
       1#Female  |   .0127775   .0126358     1.01   0.312    -.0119915    .0375466
                 |
             age |   .0000922    .000235     0.39   0.695    -.0003685    .0005528
      race_group |  -.0605679   .0231916    -2.61   0.009    -.1060287    -.015107
        religion |   .0076462   .0040013     1.91   0.056    -.0001974    .0154897
          ethnic |  -.0000139   .0000225    -0.62   0.537     -.000058    .0000302
     urban_rural |   .0112402   .0079229     1.42   0.156    -.0042905    .0267708
      educ_group |  -.0187267   .0044839    -4.18   0.000    -.0275161   -.0099372
       emp_group |  -.0052874   .0044503    -1.19   0.235     -.014011    .0034363
          safety |   -.018304   .0057113    -3.20   0.001    -.0294995   -.0071084
   fearing_crime |  -.0112363     .00602    -1.87   0.062    -.0230369    .0005643
           voted |   .0096326   .0081782     1.18   0.239    -.0063985    .0256637
discuss_politics |   .0037925   .0050137     0.76   0.449    -.0060355    .0136205
  police_station |    .010674   .0074934     1.42   0.154    -.0040147    .0253627
   soldiers_army |   .0150977    .016837     0.90   0.370    -.0179067    .0481021
     piped_water |  -.0172852   .0074619    -2.32   0.021    -.0319122   -.0026582
                 |
      surveyyear |
           2022  |    -.02645   .0432291    -0.61   0.541    -.1111889    .0582889
                 |
        cntrynum |
          Benin  |   .0266558   .0475582     0.56   0.575     -.066569    .1198806
   Burkina Faso  |  -.0427451   .0472053    -0.91   0.365    -.1352781    .0497879
       Cameroon  |   .0190316   .0351381     0.54   0.588     -.049847    .0879102
          Ghana  |   .1418731   .0444405     3.19   0.001     .0547597    .2289865
         Guinea  |  -.1880976   .0397824    -4.73   0.000      -.26608   -.1101151
          Kenya  |          0  (omitted)
        Morocco  |   .1786081   .0565427     3.16   0.002     .0677717    .2894445
          Niger  |   .1023798   .0338817     3.02   0.003     .0359639    .1687957
        Senegal  |    .083582   .0401891     2.08   0.038     .0048024    .1623617
   Sierra Leone  |   .1482819   .0360291     4.12   0.000     .0776568    .2189071
       Tanzania  |    .160438   .0369375     4.34   0.000     .0880321    .2328439
       Zimbabwe  |  -.0082192   .0367274    -0.22   0.823    -.0802132    .0637747
                 |
           _cons |   .6209427   .0386794    16.05   0.000     .5451222    .6967632
----------------------------------------------------------------------------------

Average marginal effects

Number of strata =     1                          Number of obs   =      9,046
Number of PSUs   = 9,046                          Population size = 11,724.864
Model VCE: Linearized                             Design df       =      9,045

Expression: Linear prediction, predict()
dy/dx wrt:  1.time_zero
1._at: gender = 0
2._at: gender = 1

------------------------------------------------------------------------------
             |            Delta-method
             |      dy/dx   std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
0.time_zero  |  (base outcome)
-------------+----------------------------------------------------------------
1.time_zero  |
         _at |
          1  |  -.0313567   .0106489    -2.94   0.003     -.052231   -.0104824
          2  |  -.0185792   .0103847    -1.79   0.074    -.0389356    .0017772
------------------------------------------------------------------------------
Note: dy/dx for factor levels is the discrete change from the base level.

Variables that uniquely identify margins: gender
r; t=4.57 15:22:13

. 
. graph combine $zoutcomes_group1
r; t=1.80 15:22:15

. graph save   "${graph}/gender.gph", replace
file /Users/souleymane.yameogo/Library/CloudStorage/Dropbox/WP3_OnlineCivics/Conflict project/Conflict-N
> igeria/Observationaldata/R9-Acled/JCR replication/output/graphs/gender.gph saved
r; t=0.42 15:22:15

. graph export "${graph}/gender.eps", replace
file /Users/souleymane.yameogo/Library/CloudStorage/Dropbox/WP3_OnlineCivics/Conflict
    project/Conflict-Nigeria/Observationaldata/R9-Acled/JCR replication/output/graphs/gender.eps saved
    as EPS format
r; t=0.02 15:22:15

. graph export "${graph}/gender.pdf", as(pdf) replace
file /Users/souleymane.yameogo/Library/CloudStorage/Dropbox/WP3_OnlineCivics/Conflict
    project/Conflict-Nigeria/Observationaldata/R9-Acled/JCR replication/output/graphs/gender.pdf saved
    as PDF format
r; t=0.02 15:22:15

. 
. ***************************************************************
. * 10. FIGURE 6 – HETEROGENEITY BY AGE GROUP
. ***************************************************************
. 
. * Recode age into groups
. capture drop age_gr
r; t=0.00 15:22:15

. recode age ///
>     (18/34 = 1) ///
>     (35/44 = 2) ///
>     (45/103 = 3), generate(age_gr)
(10,198 differences between age and age_gr)
r; t=0.03 15:22:15

. 
. label define age_groups_lbl 1 "18–34" 2 "35–44" 3 "45+"
r; t=0.00 15:22:15

. label values age_gr age_groups_lbl
r; t=0.00 15:22:15

. label variable age_gr "Age groups"
r; t=0.00 15:22:15

. tab age_gr

 Age groups |      Freq.     Percent        Cum.
------------+-----------------------------------
      18–34 |      4,807       47.14       47.14
      35–44 |      2,245       22.01       69.15
        45+ |      3,146       30.85      100.00
------------+-----------------------------------
      Total |     10,198      100.00
r; t=0.00 15:22:15

. 
. svyset, clear
r; t=0.00 15:22:15

. global cvar_age gender race_group religion ethnic urban_rural educ_group emp_group ///
>                 safety fearing_crime voted discuss_politics ///
>                 police_station soldiers_army piped_water 
r; t=0.00 15:22:15

. 
. *drop balance_age
. ebalance time_zero $cvar_age, generate(balance_age) targets(3)


Data Setup
Treatment variable:   time_zero
Covariate adjustment: gender race_group religion ethnic urban_rural educ_group emp_group safety fearing_
> crime voted discuss_politics police_station soldiers_army piped_water (1st order). gender race_group r
> eligion ethnic urban_rural educ_group emp_group safety fearing_crime voted discuss_politics police_sta
> tion soldiers_army piped_water (2nd order). gender race_group religion ethnic urban_rural educ_group e
> mp_group safety fearing_crime voted discuss_politics police_station soldiers_army piped_water (3rd ord
> er).


Optimizing...
Iteration 1: Max Difference = 22368.6758
Iteration 2: Max Difference = 8226.96194
Iteration 3: Max Difference = 3024.51724
Iteration 4: Max Difference = 1110.64774
Iteration 5: Max Difference = 406.582491
Iteration 6: Max Difference = 147.592967
Iteration 7: Max Difference = 52.3738543
Iteration 8: Max Difference = 17.4939155
Iteration 9: Max Difference = 5.00356173
Iteration 10: Max Difference = .990349778
Iteration 11: Max Difference = .111828213
Iteration 12: Max Difference = .003503883
maximum difference smaller than the tolerance level; convergence achieved


Treated units: 6048    total of weights: 6048
Control units: 3286    total of weights: 6048


Before: without weighting

             |              Treat              |             Control             
             |      mean   variance   skewness |      mean   variance   skewness 
-------------+---------------------------------+--------------------------------
      gender |     .4998        .25   .0006614 |     .4997      .2501    .001217 
  race_group |     1.191      .3343      2.753 |     1.129      .2393       3.54 
    religion |     1.851      1.051      1.174 |     1.976      1.043          1 
      ethnic |     762.4     254141      .5949 |       681     260663      .6822 
 urban_rural |     1.559      .2466     -.2364 |     1.662       .224      -.683 
  educ_group |     1.979       .877      .5573 |      1.95      .8319      .4651 
   emp_group |     1.568      .6932      .9469 |      1.52      .6558      1.083 
      safety |     1.514      .5753      1.071 |     1.442      .5115      1.292 
fearing_cr~e |     1.391      .4882      1.491 |     1.358      .4624      1.634 
       voted |      .734      .1953     -1.059 |      .783        .17     -1.373 
discuss_po~s |     .8661      .4676      .1762 |     .8533      .5027      .2179 
police_sta~n |     .3651      .2318      .5605 |     .3168      .2165      .7876 
soldiers_a~y |     .1005     .09044      2.657 |    .03469      .0335      5.085 
 piped_water |     .5294      .2492     -.1179 |      .458      .2483      .1686 


After:  balance_age as the weighting variable

             |              Treat              |             Control             
             |      mean   variance   skewness |      mean   variance   skewness 
-------------+---------------------------------+--------------------------------
      gender |     .4998        .25   .0006614 |     .4998      .2501   .0006675 
  race_group |     1.191      .3343      2.753 |     1.191      .3343      2.754 
    religion |     1.851      1.051      1.174 |     1.851      1.051      1.173 
      ethnic |     762.4     254141      .5949 |     762.4     254167      .5949 
 urban_rural |     1.559      .2466     -.2364 |     1.559      .2466     -.2367 
  educ_group |     1.979       .877      .5573 |     1.979       .877      .5571 
   emp_group |     1.568      .6932      .9469 |     1.568      .6932      .9469 
      safety |     1.514      .5753      1.071 |     1.514      .5753      1.071 
fearing_cr~e |     1.391      .4882      1.491 |     1.391      .4882      1.491 
       voted |      .734      .1953     -1.059 |      .734      .1953     -1.059 
discuss_po~s |     .8661      .4676      .1762 |     .8661      .4676      .1761 
police_sta~n |     .3651      .2318      .5605 |      .365      .2319      .5607 
soldiers_a~y |     .1005     .09044      2.657 |     .1005     .09043      2.657 
 piped_water |     .5294      .2492     -.1179 |     .5294      .2492     -.1179 
r; t=0.58 15:22:16

. svyset [pweight = balance_age]

Sampling weights: balance_age
             VCE: linearized
     Single unit: missing
        Strata 1: <one>
 Sampling unit 1: <observations>
           FPC 1: <zero>
r; t=0.00 15:22:16

. 
. foreach k of varlist $zoutcomes_group1 {
  2.     local title_label ""
  3.     if "`k'" == "zdemo_support" local title_label "Democratic support"
  4.     if "`k'" == "zauth_support" local title_label "Rejection of authoritarian alternatives"
  5.     if "`k'" == "zdemo_rated"  local title_label "Democracy rating"
  6. 
.     svy: reg `k' i.time_zero##i.age_gr $cvar_age i.surveyyear i.cntrynum
  7.     margins, dydx(time_zero) at(age_gr = (1(1)3))
  8. 
.     marginsplot, ylabel(-.15(.05).15) xlabel(, labsize(medium)) yline(0) ///
>         xtitle("Age", size(medium)) ///
>         ytitle("Effects of treatment on outcome", size(small)) ///
>         title("DV: `title_label'", size(medium)) ///
>         name(`k', replace) recastci(rspike) recast(scatter) ///
>         scale(.8) legend(off)
  9. }
(running regress on estimation sample)

Survey: Linear regression

Number of strata =     1                          Number of obs   =      9,148
Number of PSUs   = 9,148                          Population size = 11,855.607
                                                  Design df       =      9,147
                                                  F(31, 9117)     =      21.43
                                                  Prob > F        =     0.0000
                                                  R-squared       =     0.0726

----------------------------------------------------------------------------------
                 |             Linearized
   zdemo_support | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-----------------+----------------------------------------------------------------
     1.time_zero |  -.0627508   .0179526    -3.50   0.000     -.097942   -.0275597
                 |
          age_gr |
          35–44  |  -.0188557    .021807    -0.86   0.387    -.0616023    .0238909
            45+  |   .0560885   .0186627     3.01   0.003     .0195055    .0926715
                 |
time_zero#age_gr |
        1#35–44  |   .0444945   .0263636     1.69   0.091     -.007184    .0961731
          1#45+  |  -.0076529   .0229939    -0.33   0.739     -.052726    .0374202
                 |
          gender |  -.0108986   .0106164    -1.03   0.305    -.0317091    .0099119
      race_group |   .0506664   .0410665     1.23   0.217    -.0298331    .1311658
        religion |    -.00935   .0062049    -1.51   0.132     -.021513    .0028131
          ethnic |  -2.60e-06    .000031    -0.08   0.933    -.0000633    .0000581
     urban_rural |   .0315631   .0128832     2.45   0.014     .0063091    .0568172
      educ_group |   .0256636   .0070894     3.62   0.000     .0117669    .0395604
       emp_group |   -.013446   .0070429    -1.91   0.056    -.0272517    .0003597
          safety |  -.0004898   .0086108    -0.06   0.955    -.0173688    .0163892
   fearing_crime |  -.0060927   .0090545    -0.67   0.501    -.0238415    .0116562
           voted |   .0497626   .0135681     3.67   0.000     .0231661    .0763592
discuss_politics |   .0003921    .007528     0.05   0.958    -.0143645    .0151487
  police_station |   .0043229   .0119583     0.36   0.718    -.0191181    .0277639
   soldiers_army |   .0136258   .0286984     0.47   0.635    -.0426293     .069881
     piped_water |   .0138104   .0120924     1.14   0.253    -.0098935    .0375143
                 |
      surveyyear |
           2022  |  -.2838815   .0626219    -4.53   0.000    -.4066345   -.1611286
                 |
        cntrynum |
          Benin  |   .3058417   .0677268     4.52   0.000      .173082    .4386014
   Burkina Faso  |   .0343224   .0681144     0.50   0.614    -.0991971    .1678419
       Cameroon  |   .1037205   .0541011     1.92   0.055    -.0023297    .2097708
          Ghana  |   .2845777   .0638472     4.46   0.000      .159423    .4097324
         Guinea  |   .3167552   .0542847     5.84   0.000     .2103452    .4231653
          Kenya  |          0  (omitted)
        Morocco  |   .1248014    .093245     1.34   0.181    -.0579795    .3075823
          Niger  |   .1338472   .0506003     2.65   0.008     .0346594     .233035
        Senegal  |   .3987364    .057615     6.92   0.000     .2857981    .5116748
   Sierra Leone  |    .314933   .0536244     5.87   0.000     .2098172    .4200489
       Tanzania  |   .3175159   .0537209     5.91   0.000     .2122109    .4228208
       Zimbabwe  |   .3032121   .0528903     5.73   0.000     .1995353    .4068889
                 |
           _cons |   .6380721   .0628218    10.16   0.000     .5149274    .7612167
----------------------------------------------------------------------------------

Average marginal effects

Number of strata =     1                          Number of obs   =      9,148
Number of PSUs   = 9,148                          Population size = 11,855.607
Model VCE: Linearized                             Design df       =      9,147

Expression: Linear prediction, predict()
dy/dx wrt:  1.time_zero
1._at: age_gr = 1
2._at: age_gr = 2
3._at: age_gr = 3

------------------------------------------------------------------------------
             |            Delta-method
             |      dy/dx   std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
0.time_zero  |  (base outcome)
-------------+----------------------------------------------------------------
1.time_zero  |
         _at |
          1  |  -.0627508   .0179526    -3.50   0.000     -.097942   -.0275597
          2  |  -.0182563   .0227279    -0.80   0.422    -.0628081    .0262955
          3  |  -.0704037   .0189431    -3.72   0.000    -.1075363   -.0332711
------------------------------------------------------------------------------
Note: dy/dx for factor levels is the discrete change from the base level.

Variables that uniquely identify margins: age_gr
(running regress on estimation sample)

Survey: Linear regression

Number of strata =     1                          Number of obs   =      9,277
Number of PSUs   = 9,277                          Population size = 12,025.038
                                                  Design df       =      9,276
                                                  F(31, 9246)     =      36.80
                                                  Prob > F        =     0.0000
                                                  R-squared       =     0.1247

----------------------------------------------------------------------------------
                 |             Linearized
   zauth_support | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-----------------+----------------------------------------------------------------
     1.time_zero |   .0140903   .0113555     1.24   0.215    -.0081689    .0363496
                 |
          age_gr |
          35–44  |   .0035517   .0136237     0.26   0.794    -.0231538    .0302572
            45+  |   .0369988   .0117875     3.14   0.002     .0138928    .0601049
                 |
time_zero#age_gr |
        1#35–44  |   .0134661   .0159925     0.84   0.400    -.0178827    .0448149
          1#45+  |  -.0194782   .0140513    -1.39   0.166    -.0470218    .0080654
                 |
          gender |  -.0282598    .006445    -4.38   0.000    -.0408934   -.0156261
      race_group |   .0778462   .0255644     3.05   0.002     .0277343     .127958
        religion |   .0016068   .0036678     0.44   0.661     -.005583    .0087965
          ethnic |   .0000374   .0000218     1.72   0.086    -5.28e-06      .00008
     urban_rural |  -.0117805    .007741    -1.52   0.128    -.0269546    .0033936
      educ_group |   .0432709     .00405    10.68   0.000     .0353321    .0512098
       emp_group |   .0042231   .0041158     1.03   0.305    -.0038447    .0122909
          safety |  -.0011608   .0052429    -0.22   0.825    -.0114379    .0091164
   fearing_crime |  -.0011049   .0055651    -0.20   0.843    -.0120136    .0098039
           voted |  -.0047118   .0079615    -0.59   0.554    -.0203181    .0108946
discuss_politics |   .0033332   .0047422     0.70   0.482    -.0059625    .0126289
  police_station |  -.0025996   .0073688    -0.35   0.724    -.0170441     .011845
   soldiers_army |   .0129704   .0152623     0.85   0.395    -.0169471    .0428879
     piped_water |   .0018453   .0072346     0.26   0.799    -.0123361    .0160266
                 |
      surveyyear |
           2022  |  -.0830554    .039069    -2.13   0.034    -.1596393   -.0064715
                 |
        cntrynum |
          Benin  |   .1044225   .0430488     2.43   0.015     .0200374    .1888075
   Burkina Faso  |  -.1334075   .0431248    -3.09   0.002    -.2179416   -.0488733
       Cameroon  |  -.1180898   .0313985    -3.76   0.000    -.1796377   -.0565419
          Ghana  |   .0407277   .0402667     1.01   0.312    -.0382039    .1196592
         Guinea  |    .061934   .0340693     1.82   0.069    -.0048494    .1287173
          Kenya  |          0  (omitted)
        Morocco  |  -.1829118   .0563381    -3.25   0.001    -.2933468   -.0724767
          Niger  |  -.1331579   .0294769    -4.52   0.000    -.1909392   -.0753766
        Senegal  |   .0977319   .0351446     2.78   0.005     .0288408     .166623
   Sierra Leone  |   .1132857   .0298924     3.79   0.000       .05469    .1718815
       Tanzania  |   .0272577   .0322306     0.85   0.398    -.0359214    .0904367
       Zimbabwe  |   .0022345    .032874     0.07   0.946    -.0622057    .0666747
                 |
           _cons |   .6782825   .0378205    17.93   0.000     .6041461    .7524189
----------------------------------------------------------------------------------

Average marginal effects

Number of strata =     1                          Number of obs   =      9,277
Number of PSUs   = 9,277                          Population size = 12,025.038
Model VCE: Linearized                             Design df       =      9,276

Expression: Linear prediction, predict()
dy/dx wrt:  1.time_zero
1._at: age_gr = 1
2._at: age_gr = 2
3._at: age_gr = 3

------------------------------------------------------------------------------
             |            Delta-method
             |      dy/dx   std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
0.time_zero  |  (base outcome)
-------------+----------------------------------------------------------------
1.time_zero  |
         _at |
          1  |   .0140903   .0113555     1.24   0.215    -.0081689    .0363496
          2  |   .0275564   .0145638     1.89   0.059    -.0009918    .0561046
          3  |  -.0053879   .0119734    -0.45   0.653    -.0288584    .0180827
------------------------------------------------------------------------------
Note: dy/dx for factor levels is the discrete change from the base level.

Variables that uniquely identify margins: age_gr
(running regress on estimation sample)

Survey: Linear regression

Number of strata =     1                          Number of obs   =      9,046
Number of PSUs   = 9,046                          Population size = 11,723.609
                                                  Design df       =      9,045
                                                  F(31, 9015)     =      22.60
                                                  Prob > F        =     0.0000
                                                  R-squared       =     0.0897

----------------------------------------------------------------------------------
                 |             Linearized
     zdemo_rated | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-----------------+----------------------------------------------------------------
     1.time_zero |  -.0110049   .0111317    -0.99   0.323    -.0328255    .0108157
                 |
          age_gr |
          35–44  |   .0211809   .0134533     1.57   0.115    -.0051905    .0475524
            45+  |   .0113055   .0126662     0.89   0.372    -.0135231    .0361341
                 |
time_zero#age_gr |
        1#35–44  |  -.0319168   .0160094    -1.99   0.046    -.0632988   -.0005348
          1#45+  |    -.02193    .014816    -1.48   0.139    -.0509727    .0071127
                 |
          gender |    .011756   .0066255     1.77   0.076    -.0012314    .0247435
      race_group |  -.0604867    .023252    -2.60   0.009     -.106066   -.0149075
        religion |   .0078076   .0039934     1.96   0.051    -.0000203    .0156355
          ethnic |  -.0000148   .0000228    -0.65   0.515    -.0000595    .0000298
     urban_rural |   .0113345    .007951     1.43   0.154    -.0042512    .0269202
      educ_group |  -.0191102   .0045305    -4.22   0.000     -.027991   -.0102294
       emp_group |   -.005827    .004472    -1.30   0.193    -.0145932    .0029391
          safety |  -.0183584   .0056906    -3.23   0.001    -.0295133   -.0072034
   fearing_crime |  -.0114941   .0060125    -1.91   0.056    -.0232801    .0002918
           voted |   .0102686     .00822     1.25   0.212    -.0058444    .0263816
discuss_politics |   .0043699   .0049963     0.87   0.382    -.0054241    .0141639
  police_station |   .0102629   .0074995     1.37   0.171    -.0044377    .0249636
   soldiers_army |   .0167344   .0169046     0.99   0.322    -.0164025    .0498713
     piped_water |  -.0168159    .007469    -2.25   0.024    -.0314569    -.002175
                 |
      surveyyear |
           2022  |  -.0226636    .043562    -0.52   0.603     -.108055    .0627278
                 |
        cntrynum |
          Benin  |   .0221118   .0480285     0.46   0.645    -.0720349    .1162586
   Burkina Faso  |  -.0471988   .0476435    -0.99   0.322    -.1405908    .0461932
       Cameroon  |   .0145363   .0351527     0.41   0.679    -.0543709    .0834434
          Ghana  |   .1377505   .0448493     3.07   0.002     .0498357    .2256652
         Guinea  |  -.1923841   .0396511    -4.85   0.000    -.2701092    -.114659
          Kenya  |          0  (omitted)
        Morocco  |    .176131   .0565081     3.12   0.002     .0653624    .2868997
          Niger  |   .0994192    .033894     2.93   0.003     .0329793    .1658591
        Senegal  |    .081172   .0403482     2.01   0.044     .0020804    .1602636
   Sierra Leone  |     .14393   .0361431     3.98   0.000     .0730814    .2147785
       Tanzania  |   .1575336   .0371246     4.24   0.000     .0847609    .2303063
       Zimbabwe  |   -.011479    .036858    -0.31   0.755    -.0837291     .060771
                 |
           _cons |   .6141357   .0379069    16.20   0.000     .5398297    .6884418
----------------------------------------------------------------------------------

Average marginal effects

Number of strata =     1                          Number of obs   =      9,046
Number of PSUs   = 9,046                          Population size = 11,723.609
Model VCE: Linearized                             Design df       =      9,045

Expression: Linear prediction, predict()
dy/dx wrt:  1.time_zero
1._at: age_gr = 1
2._at: age_gr = 2
3._at: age_gr = 3

------------------------------------------------------------------------------
             |            Delta-method
             |      dy/dx   std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
0.time_zero  |  (base outcome)
-------------+----------------------------------------------------------------
1.time_zero  |
         _at |
          1  |  -.0110049   .0111317    -0.99   0.323    -.0328255    .0108157
          2  |  -.0429217     .01406    -3.05   0.002    -.0704824    -.015361
          3  |  -.0329349   .0124233    -2.65   0.008    -.0572875   -.0085823
------------------------------------------------------------------------------
Note: dy/dx for factor levels is the discrete change from the base level.

Variables that uniquely identify margins: age_gr
r; t=5.24 15:22:21

. 
. graph combine $zoutcomes_group1
r; t=1.93 15:22:23

. graph save   "${graph}/age.gph", replace
file /Users/souleymane.yameogo/Library/CloudStorage/Dropbox/WP3_OnlineCivics/Conflict project/Conflict-N
> igeria/Observationaldata/R9-Acled/JCR replication/output/graphs/age.gph saved
r; t=0.45 15:22:23

. graph export "${graph}/age.eps", replace
file /Users/souleymane.yameogo/Library/CloudStorage/Dropbox/WP3_OnlineCivics/Conflict
    project/Conflict-Nigeria/Observationaldata/R9-Acled/JCR replication/output/graphs/age.eps saved as
    EPS format
r; t=0.03 15:22:24

. graph export "${graph}/age.pdf", as(pdf) replace
file /Users/souleymane.yameogo/Library/CloudStorage/Dropbox/WP3_OnlineCivics/Conflict
    project/Conflict-Nigeria/Observationaldata/R9-Acled/JCR replication/output/graphs/age.pdf saved as
    PDF format
r; t=0.02 15:22:24

. 
. ***************************************************************
. * 11. FIGURE 7 – COUNTRY-SPECIFIC EFFECTS (COEFPLOTS)
. ***************************************************************
. 
. use "${data_new}/data_goodcountries.dta", clear
r; t=0.08 15:22:24

. 
. * z-outcomes should already exist in this file; if not, recreate:
. capture confirm variable zdemo_support
r; t=0.00 15:22:24

. if _rc {
.     global outcomes_groups demo_support auth_support demo_rated
r; t=0.00 15:22:24
.     foreach v of varlist $outcomes_groups {
  2.         qui summ `v'
  3.         gen z`v' = (`v' - r(min)) / (r(max) - r(min))
  4.     }
(211 missing values generated)
(67 missing values generated)
(338 missing values generated)
r; t=0.00 15:22:24
. }
r; t=0.00 15:22:24

. global zoutcomes_group1 zdemo_support zauth_support zdemo_rated
r; t=0.00 15:22:24

. su $zoutcomes_group1

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
zdemo_supp~t |      9,990    .7117117    .4529886          0          1
zauth_supp~t |     10,134       .7842    .2834817          0          1
 zdemo_rated |      9,863    .5276792    .2740082          0          1
r; t=0.00 15:22:24

. encode country, gen(cntry)
r; t=0.00 15:22:24

. 
. local countr  `" "Angola" "Benin" "Burkina Faso" "Cameroon" "Ghana" "Guinea" "Kenya" "Morocco" "Niger"
>  "Senegal" "Sierra Leone" "Tanzania" "Zimbabwe" "'
r; t=0.00 15:22:24

. local outcomes "zdemo_support zauth_support zdemo_rated"
r; t=0.00 15:22:24

. 
. local n_countr : word count `countr'
r; t=0.00 15:22:24

. local graphlist
r; t=0.00 15:22:24

. estimates clear
r; t=0.02 15:22:24

. 
. * Re-define covariates for this section 
. global cvars age gender race_group religion ethnic urban_rural educ_group emp_group ///
>              safety fearing_crime voted discuss_politics ///
>              police_station soldiers_army piped_water
r; t=0.00 15:22:24

.                          
. ebalance time_zero $cvars, generate(balance_zero) targets(3)


Data Setup
Treatment variable:   time_zero
Covariate adjustment: age gender race_group religion ethnic urban_rural educ_group emp_group safety fear
> ing_crime voted discuss_politics police_station soldiers_army piped_water (1st order). age gender race
> _group religion ethnic urban_rural educ_group emp_group safety fearing_crime voted discuss_politics po
> lice_station soldiers_army piped_water (2nd order). age gender race_group religion ethnic urban_rural 
> educ_group emp_group safety fearing_crime voted discuss_politics police_station soldiers_army piped_wa
> ter (3rd order).


Optimizing...
Iteration 1: Max Difference = 22351.177
Iteration 2: Max Difference = 8220.52483
Iteration 3: Max Difference = 3022.14949
Iteration 4: Max Difference = 1109.77703
Iteration 5: Max Difference = 406.262531
Iteration 6: Max Difference = 147.475677
Iteration 7: Max Difference = 52.3312784
Iteration 8: Max Difference = 17.4791893
Iteration 9: Max Difference = 4.99961192
Iteration 10: Max Difference = .990642593
Iteration 11: Max Difference = .087979281
Iteration 12: Max Difference = .00120722
maximum difference smaller than the tolerance level; convergence achieved


Treated units: 6047    total of weights: 6047
Control units: 3285    total of weights: 6047


Before: without weighting

             |              Treat              |             Control             
             |      mean   variance   skewness |      mean   variance   skewness 
-------------+---------------------------------+--------------------------------
         age |     38.77      210.3      .7741 |     39.49      223.4      .7352 
      gender |     .4998        .25   .0009922 |     .4998      .2501   .0006088 
  race_group |     1.191      .3344      2.753 |     1.129      .2393      3.539 
    religion |     1.851      1.051      1.173 |     1.976      1.043      1.001 
      ethnic |     762.3     254093      .5954 |     680.6     260394      .6825 
 urban_rural |     1.559      .2466     -.2361 |     1.661       .224     -.6825 
  educ_group |     1.979       .877      .5577 |      1.95      .8321      .4651 
   emp_group |     1.568      .6933      .9472 |      1.52      .6559      1.083 
      safety |     1.514      .5753      1.071 |     1.441      .5116      1.293 
fearing_cr~e |     1.391      .4883      1.491 |     1.358      .4625      1.634 
       voted |     .7341      .1952      -1.06 |      .783        .17     -1.373 
discuss_po~s |     .8662      .4675      .1759 |     .8533      .5028       .218 
police_sta~n |     .3651      .2319      .5602 |     .3169      .2165      .7871 
soldiers_a~y |     .1005     .09045      2.657 |     .0347     .03351      5.084 
 piped_water |     .5295      .2492     -.1183 |     .4581      .2483       .168 


After:  balance_zero as the weighting variable

             |              Treat              |             Control             
             |      mean   variance   skewness |      mean   variance   skewness 
-------------+---------------------------------+--------------------------------
         age |     38.77      210.3      .7741 |     38.77      210.3      .7739 
      gender |     .4998        .25   .0009922 |     .4997      .2501    .001004 
  race_group |     1.191      .3344      2.753 |     1.191      .3344      2.753 
    religion |     1.851      1.051      1.173 |     1.851      1.051      1.173 
      ethnic |     762.3     254093      .5954 |     762.3     254118      .5954 
 urban_rural |     1.559      .2466     -.2361 |     1.559      .2466     -.2364 
  educ_group |     1.979       .877      .5577 |     1.979       .877      .5575 
   emp_group |     1.568      .6933      .9472 |     1.568      .6933      .9471 
      safety |     1.514      .5753      1.071 |     1.514      .5753      1.071 
fearing_cr~e |     1.391      .4883      1.491 |     1.391      .4883      1.491 
       voted |     .7341      .1952      -1.06 |     .7341      .1952      -1.06 
discuss_po~s |     .8662      .4675      .1759 |     .8662      .4676      .1759 
police_sta~n |     .3651      .2319      .5602 |     .3651      .2319      .5604 
soldiers_a~y |     .1005     .09045      2.657 |     .1005     .09044      2.657 
 piped_water |     .5295      .2492     -.1183 |     .5295      .2492     -.1182 
r; t=0.60 15:22:24

. svyset [pweight = balance_zero]

Sampling weights: balance_zero
             VCE: linearized
     Single unit: missing
        Strata 1: <one>
 Sampling unit 1: <observations>
           FPC 1: <zero>
r; t=0.00 15:22:24

. 
. * NOTE: you may want to re-set svy weights here as above if needed.
. 
. forvalues i = 1/`n_countr' {
  2.     local cntrylbl : word `i' of `countr'
  3.     local estlist
  4. 
.     foreach var of local outcomes {
  5.         quietly capture svy: reg `var' i.time_zero $cvars i.surveyyear if cntry == `i'
  6.         if !_rc {
  7.             estimates store est_`var'_`i'
  8.             local estlist `estlist' est_`var'_`i'
  9.         }
 10.     }
 11. 
.     if "`estlist'" != "" {
 12.         local gname g_`i'
 13. 
.         capture noisily coefplot `estlist', ///
>             keep(1.time_zero) ///
>             drop(_cons) ///
>             xline(0, lcolor(gs10)) ///
>             coeflabels(1.time_zero = " ") ///
>             plotlabels("Support for democracy" ///
>                        "Rejection of authoritarianism" ///
>                        "Democracy rating") ///
>             legend(rows(1)) ///
>             title("`cntrylbl'", size(medsmall)) ///
>             legend(off) ///
>             ylabel(, labsize(small)) ///
>             xlabel(-0.4(0.2)0.25, labsize(small)) ///
>             name(`gname', replace) ///
>             ysize(2) xsize(5)
 14. 
.         capture confirm graph `gname'
 15.         if !_rc local graphlist `graphlist' `gname'
 16.     }
 17. }
r; t=10.73 15:22:35

. 
. * Combine graphs (manual list if preferred)
.         grc1leg g_1 g_2 g_3 g_4 g_5 g_6 g_7 g_8 g_9 g_10 g_11 g_12 g_13, ///
>     cols(3) imargin(2 2 2 2) xsize(8) ysize(7)
r; t=9.93 15:22:45

. 
. graph save   "${graph}/DV1_countries.gph", replace
file /Users/souleymane.yameogo/Library/CloudStorage/Dropbox/WP3_OnlineCivics/Conflict project/Conflict-N
> igeria/Observationaldata/R9-Acled/JCR replication/output/graphs/DV1_countries.gph saved
r; t=2.69 15:22:48

. graph export "${graph}/DV1_countries.pdf", as(pdf) replace
file /Users/souleymane.yameogo/Library/CloudStorage/Dropbox/WP3_OnlineCivics/Conflict
    project/Conflict-Nigeria/Observationaldata/R9-Acled/JCR
    replication/output/graphs/DV1_countries.pdf saved as PDF format
r; t=0.05 15:22:48

. 
. //******************************************************
. // APPENDIX
. //******************************************************
. 
. ***************************************************************
. * Appendix C – Balance and weighting procedures (Main sample)
. ***************************************************************
. 
. * Use restricted sample again
. use "${data_new}/data_goodcountries.dta", clear
r; t=0.06 15:22:48

. 
. * Same covariates with factor notation for balance regressions (Appendix)
. global cvars_demographics age gender ib1.race_group ib1.religion ethnic ///
>                            ib1.urban_rural ib4.educ_group ///
>                            safety fearing_crime voted ///
>                            police_station soldiers_army piped_water
r; t=0.00 15:22:48

. 
. * Recreate ebalance weights for balance plots
. //drop balance_zero
. ebalance time_zero $cvars_demographics, generate(balance_zero) targets(3)
note: 1b.race_group omitted because of collinearity
note: 1b.religion omitted because of collinearity
note: 1b.urban_rural omitted because of collinearity
note: 4b.educ_group omitted because of collinearity


Data Setup
Treatment variable:   time_zero
Covariate adjustment: age gender 2.race_group 3.race_group 2.religion 3.religion 4.religion 5.religion e
> thnic 2.urban_rural 1.educ_group 2.educ_group 3.educ_group safety fearing_crime voted police_station s
> oldiers_army piped_water (1st order). age gender 2.race_group 3.race_group 2.religion 3.religion 4.rel
> igion 5.religion ethnic 2.urban_rural 1.educ_group 2.educ_group 3.educ_group safety fearing_crime vote
> d police_station soldiers_army piped_water (2nd order). age gender 2.race_group 3.race_group 2.religio
> n 3.religion 4.religion 5.religion ethnic 2.urban_rural 1.educ_group 2.educ_group 3.educ_group safety 
> fearing_crime voted police_station soldiers_army piped_water (3rd order).


Optimizing...
Iteration 1: Max Difference = 22431.0507
Iteration 2: Max Difference = 8249.90442
Iteration 3: Max Difference = 3032.95332
Iteration 4: Max Difference = 1113.74719
Iteration 5: Max Difference = 407.718658
Iteration 6: Max Difference = 148.006747
Iteration 7: Max Difference = 52.5215069
Iteration 8: Max Difference = 17.5427621
Iteration 9: Max Difference = 5.01530957
Iteration 10: Max Difference = .989977222
Iteration 11: Max Difference = .086880588
Iteration 12: Max Difference = .002475312
maximum difference smaller than the tolerance level; convergence achieved


Treated units: 6070    total of weights: 6070
Control units: 3291    total of weights: 6070


Before: without weighting

             |              Treat              |             Control             
             |      mean   variance   skewness |      mean   variance   skewness 
-------------+---------------------------------+--------------------------------
         age |     38.78      210.5      .7737 |     39.49      223.3       .734 
      gender |     .4997        .25    .001318 |     .5002      .2501  -.0006077 
2.race_group |     .0112     .01108      9.288 |   .002735    .002728      19.04 
3.race_group |    .09094     .08268      2.845 |    .06351     .05949       3.58 
  2.religion |     .2537      .1894      1.132 |     .3327      .2221        .71 
  3.religion |     .2061      .1636      1.453 |     .1996      .1598      1.503 
  4.religion |    .01417     .01397      8.222 |    .03737     .03599      4.878 
  5.religion |    .03542     .03417      5.027 |    .03282     .03175      5.245 
      ethnic |     763.9     254440      .5888 |     681.8     261228      .6806 
2.urban_ru~l |      .558      .2467     -.2335 |     .6615       .224     -.6826 
1.educ_group |     .3787      .2353      .4999 |     .3965      .2394       .423 
2.educ_group |     .3343      .2226      .7027 |     .3045      .2118      .8498 
3.educ_group |     .2161      .1695      1.379 |     .2528       .189      1.137 
      safety |     1.513      .5751      1.074 |     1.442      .5118       1.29 
fearing_cr~e |      1.39      .4874      1.495 |     1.358      .4628      1.631 
       voted |     .7336      .1955     -1.057 |      .783      .1699     -1.373 
police_sta~n |     .3654      .2319       .559 |     .3166      .2164      .7885 
soldiers_a~y |     .1005     .09041      2.658 |    .03464     .03345       5.09 
 piped_water |     .5303      .2491     -.1215 |     .4576      .2483      .1702 


After:  balance_zero as the weighting variable

             |              Treat              |             Control             
             |      mean   variance   skewness |      mean   variance   skewness 
-------------+---------------------------------+--------------------------------
         age |     38.78      210.5      .7737 |     38.79      210.6      .7735 
      gender |     .4997        .25    .001318 |     .4997      .2501     .00135 
2.race_group |     .0112     .01108      9.288 |     .0112     .01108       9.29 
3.race_group |    .09094     .08268      2.845 |    .09091     .08267      2.846 
  2.religion |     .2537      .1894      1.132 |     .2537      .1894      1.132 
  3.religion |     .2061      .1636      1.453 |      .206      .1636      1.454 
  4.religion |    .01417     .01397      8.222 |    .01427     .01408      8.189 
  5.religion |    .03542     .03417      5.027 |    .03541     .03417      5.028 
      ethnic |     763.9     254440      .5888 |     763.8     254481      .5888 
2.urban_ru~l |      .558      .2467     -.2335 |     .5581      .2467     -.2338 
1.educ_group |     .3787      .2353      .4999 |     .3787      .2354      .4999 
2.educ_group |     .3343      .2226      .7027 |     .3342      .2226       .703 
3.educ_group |     .2161      .1695      1.379 |     .2161      .1695      1.379 
      safety |     1.513      .5751      1.074 |     1.513      .5751      1.073 
fearing_cr~e |      1.39      .4874      1.495 |      1.39      .4874      1.495 
       voted |     .7336      .1955     -1.057 |     .7337      .1955     -1.057 
police_sta~n |     .3654      .2319       .559 |     .3653      .2319      .5593 
soldiers_a~y |     .1005     .09041      2.658 |     .1005     .09039      2.658 
 piped_water |     .5303      .2491     -.1215 |     .5303      .2492     -.1214 
r; t=0.77 15:22:48

. svyset [pweight = balance_zero]

Sampling weights: balance_zero
             VCE: linearized
     Single unit: missing
        Strata 1: <one>
 Sampling unit 1: <observations>
           FPC 1: <zero>
r; t=0.02 15:22:49

. 
. global treatments time_zero 
r; t=0.00 15:22:49

. 
. estimates clear
r; t=0.03 15:22:49

. 
. foreach y of varlist $treatments {
  2.     qui reg `y' $cvars_demographics
  3.     estimates store T0_`y'
  4. 
.     qui svy: reg `y' $cvars_demographics
  5.     estimates store T1_`y'
  6. }
r; t=0.33 15:22:49

. 
. coefplot T0_time_zero || T1_time_zero, ///
>     drop(_cons) xline(0, lpattern(solid)) ///
>     byopts(row(1)) levels(99 95) ///
>     bylabels("(A) Treatment all" "(B) Using weight") ///
>     mlabel(cond(@pval<.001, "***", cond(@pval<.01, "**", cond(@pval<.05, "*", "")))) ///
>     title("Balance test")
r; t=1.45 15:22:50

. 
. graph save   "${graph}/Afrobalance.gph", replace
file /Users/souleymane.yameogo/Library/CloudStorage/Dropbox/WP3_OnlineCivics/Conflict project/Conflict-N
> igeria/Observationaldata/R9-Acled/JCR replication/output/graphs/Afrobalance.gph saved
r; t=0.41 15:22:51

. graph export "${graph}/Afrobalance.eps", replace
file /Users/souleymane.yameogo/Library/CloudStorage/Dropbox/WP3_OnlineCivics/Conflict
    project/Conflict-Nigeria/Observationaldata/R9-Acled/JCR replication/output/graphs/Afrobalance.eps
    saved as EPS format
r; t=0.03 15:22:51

. graph export "${graph}/Afrobalance.pdf", as(pdf) replace
file /Users/souleymane.yameogo/Library/CloudStorage/Dropbox/WP3_OnlineCivics/Conflict
    project/Conflict-Nigeria/Observationaldata/R9-Acled/JCR replication/output/graphs/Afrobalance.pdf
    saved as PDF format
r; t=0.04 15:22:51

. 
. ***************************************************************
. * Appendix D – Full-sample robustness (31 countries)
. ***************************************************************
. 
. ********************************************************************
. * 0. LOAD DATA AND PREPARE VARIABLES
. ********************************************************************
. use "${data}/R9_final.dta", clear
r; t=0.15 15:22:51

. 
. * Ensure surveyyear exists
. capture confirm variable surveyyear
r; t=0.00 15:22:51

. if _rc {
.     capture confirm variable year
r; t=0.00 15:22:51
.     if !_rc gen surveyyear = year
r; t=0.00 15:22:51
. }
r; t=0.00 15:22:51

. 
. * Recreate z-outcomes for full sample (min–max 0–1)
. global outcomes_groups demo_support auth_support demo_rated
r; t=0.00 15:22:51

. foreach v of varlist $outcomes_groups {
  2.     qui summ `v'
  3.     gen z`v' = (`v' - r(min)) / (r(max) - r(min))
  4. }
(354 missing values generated)
(101 missing values generated)
(606 missing values generated)
r; t=0.01 15:22:51

. global zoutcomes_group1 zdemo_support zauth_support zdemo_rated  
r; t=0.00 15:22:51

. su $zoutcomes_group1

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
zdemo_supp~t |     20,109    .6603014    .4736187          0          1
zauth_supp~t |     20,362    .7644468    .2911703          0          1
 zdemo_rated |     19,857    .4941582    .2859719          0          1
r; t=0.00 15:22:51

. 
. * Treatment indicator
. global treatments time_zero 
r; t=0.00 15:22:51

. 
. * Clear any previous survey settings
. svyset, clear
r; t=0.00 15:22:51

. 
. * Entropy balancing weights
. // drop balance_zero   // uncomment if balance_zero already exists
. ebalance time_zero $cvars, generate(balance_zero) targets(3)


Data Setup
Treatment variable:   time_zero
Covariate adjustment: age gender race_group religion ethnic urban_rural educ_group emp_group safety fear
> ing_crime voted discuss_politics police_station soldiers_army piped_water (1st order). age gender race
> _group religion ethnic urban_rural educ_group emp_group safety fearing_crime voted discuss_politics po
> lice_station soldiers_army piped_water (2nd order). age gender race_group religion ethnic urban_rural 
> educ_group emp_group safety fearing_crime voted discuss_politics police_station soldiers_army piped_wa
> ter (3rd order).


Optimizing...
Iteration 1: Max Difference = 41992.5386
Iteration 2: Max Difference = 15446.5235
Iteration 3: Max Difference = 5680.79267
Iteration 4: Max Difference = 2088.18751
Iteration 5: Max Difference = 766.559691
Iteration 6: Max Difference = 280.409808
Iteration 7: Max Difference = 101.710933
Iteration 8: Max Difference = 36.4087797
Iteration 9: Max Difference = 13.277532
Iteration 10: Max Difference = 4.89015736
Iteration 11: Max Difference = 1.54373346
Iteration 12: Max Difference = .271451825
Iteration 13: Max Difference = .009718966
maximum difference smaller than the tolerance level; convergence achieved


Treated units: 12668   total of weights: 12668
Control units: 4730    total of weights: 12668


Before: without weighting

             |              Treat              |             Control             
             |      mean   variance   skewness |      mean   variance   skewness 
-------------+---------------------------------+--------------------------------
         age |     37.91      205.7      .8353 |     38.78      217.3      .7702 
      gender |     .4995        .25    .001895 |     .5002      .2501  -.0008457 
  race_group |      1.13      .2295      3.527 |     1.091      .1709       4.37 
    religion |     1.965       1.13       1.15 |     2.147      1.184      .8553 
      ethnic |     746.7     177788      .8428 |     771.3     270168      .4906 
 urban_rural |     1.569      .2452      -.279 |     1.671      .2207     -.7291 
  educ_group |     1.997      .8785      .4604 |     1.919      .7969      .5078 
   emp_group |     1.602      .7326      .8621 |     1.443      .5982      1.331 
      safety |     1.582      .6421      .8949 |     1.472      .5284      1.188 
fearing_cr~e |     1.496      .5999      1.144 |      1.36      .4602      1.619 
       voted |     .7217      .2009     -.9892 |     .7789      .1723     -1.344 
discuss_po~s |     .8398      .5063      .2422 |      .833      .5054      .2529 
police_sta~n |      .343      .2254      .6615 |     .2977      .2091       .885 
soldiers_a~y |    .09181     .08338      2.827 |    .04334     .04147      4.485 
 piped_water |     .4972        .25     .01105 |     .4288       .245      .2879 


After:  balance_zero as the weighting variable

             |              Treat              |             Control             
             |      mean   variance   skewness |      mean   variance   skewness 
-------------+---------------------------------+--------------------------------
         age |     37.91      205.7      .8353 |     37.91      205.7      .8352 
      gender |     .4995        .25    .001895 |     .4995      .2501    .001887 
  race_group |      1.13      .2295      3.527 |      1.13      .2295      3.527 
    religion |     1.965       1.13       1.15 |     1.965       1.13       1.15 
      ethnic |     746.7     177788      .8428 |     746.8     177881      .8426 
 urban_rural |     1.569      .2452      -.279 |     1.569      .2453      -.279 
  educ_group |     1.997      .8785      .4604 |     1.997      .8785      .4603 
   emp_group |     1.602      .7326      .8621 |     1.602      .7326      .8621 
      safety |     1.582      .6421      .8949 |     1.582      .6422      .8947 
fearing_cr~e |     1.496      .5999      1.144 |     1.496      .5999      1.144 
       voted |     .7217      .2009     -.9892 |     .7217      .2009     -.9894 
discuss_po~s |     .8398      .5063      .2422 |     .8398      .5063      .2421 
police_sta~n |      .343      .2254      .6615 |     .3429      .2254      .6617 
soldiers_a~y |    .09181     .08338      2.827 |    .09179     .08338      2.828 
 piped_water |     .4972        .25     .01105 |     .4972        .25     .01106 
r; t=1.34 15:22:52

. svyset [pweight = balance_zero]

Sampling weights: balance_zero
             VCE: linearized
     Single unit: missing
        Strata 1: <one>
 Sampling unit 1: <observations>
           FPC 1: <zero>
r; t=0.00 15:22:52

. 
. * Clean old files (optional – kept from your template)
. capture erase "${table}/t1_e.xls"
r; t=0.00 15:22:52

. capture erase "${table}/t1_e.rtf"
r; t=0.00 15:22:52

. estimates clear
r; t=0.02 15:22:52

. 
. * Make sure esttab / eststo / estadd are available
. cap which esttab
r; t=0.00 15:22:52

. if _rc ssc install estout, replace
r; t=0.00 15:22:52

. 
. local models
r; t=0.00 15:22:52

. 
. foreach k of varlist $zoutcomes_group1 {
  2.     
.     *--------------------------
.     * 1) Run model
.     *--------------------------
.     quietly svy: reg `k' i.time_zero $cvars i.cntrynum i.surveyyear
  3.     
.     *--------------------------
.     * 2) Control-group summary
.     *--------------------------
.     quietly summarize `k' if time_zero == 0
  4.     local m   = r(mean)
  5.     local min = r(min)
  6.     local max = r(max)
  7. 
.     *--------------------------
.     * 3) Short titles for table
.     *--------------------------
.     local short_title ""
  8.     if "`k'" == "zdemo_support" local short_title "Support for democracy"
  9.     if "`k'" == "zauth_support" local short_title "Reject authoritarianism"
 10.     if "`k'" == "zdemo_rated"   local short_title "Democracy rating"
 11. 
.     *--------------------------
.     * 4) Add custom stats to e()
.     *--------------------------
.     qui estadd scalar cmean = `m'
 12.     qui estadd scalar cmin  = `min'
 13.     qui estadd scalar cmax  = `max'
 14.     qui estadd local  pretreat "Yes"
 15. 
.     * Store model with nice title
.     eststo, title("`short_title'")
 16.     local models `"`models' `e(name)'"'
 17. }
(est1 stored)
(est2 stored)
(est3 stored)
r; t=0.73 15:22:53

. 
. *------------------------------------------
. * PRINT TABLE TO RESULTS WINDOW
. *------------------------------------------
. esttab `models', ///
>     keep(1.time_zero) ///
>     b(3) se level(95) brackets ///
>     star(* 0.05 ** 0.01 *** 0.001) ///
>     label nonotes noobs nobaselevels ///
>     coeflabels(1.time_zero "Terrorism exposure") ///
>     mtitle ///
>     stats(N r2 pretreat cmean, ///
>           fmt(0 3 0 3 ) ///
>           labels("Observations" "R^2" "Pre-treatment" "Control Mean" "Min" "Max")) ///
>     compress

-------------------------------------------------------
                       (1)          (2)          (3)   
                 Support~y    Reject ~m    Democra~g   
-------------------------------------------------------
Terrorism expo~e    -0.052***     0.010       -0.020*  
                   [0.015]      [0.009]      [0.009]   
-------------------------------------------------------
Observations         17127        17319        16925   
R^2                  0.110        0.142        0.085   
Pre-treatment          Yes          Yes          Yes   
Control Mean         0.725        0.800        0.529   
-------------------------------------------------------
r; t=0.09 15:22:53

. 
. *-------------------------------*
. * EXPORT CSV
. *-------------------------------*
. esttab `models' using "${table}/appendixD_fullsample.csv", replace csv ///
>     keep(1.time_zero) ///
>     coeflabels(1.time_zero "Terrorism exposure") ///
>     b(3) se level(95) brackets ///
>     star(* 0.05 ** 0.01 *** 0.001) ///
>     mtitle ///
>     label nonotes noobs nobaselevels ///
>     stats(N r2 pretreat cmean cmin cmax, ///
>           fmt(0 3 0 3 3 3) ///
>           labels("Observations" "R^2" "Pre-treatment" "Control mean" "Min" "Max")) ///
>     compress
(output written to /Users/souleymane.yameogo/Library/CloudStorage/Dropbox/WP3_OnlineCivics/Conflict proj
> ect/Conflict-Nigeria/Observationaldata/R9-Acled/JCR replication/output/tables/appendixD_fullsample.csv
> )
r; t=0.08 15:22:53

. ***************************************************************
. * 12. PUT ALL GRAPHS INTO ONE DOCX
. ***************************************************************
. 
. putdocx begin
r; t=0.41 15:22:54

. 
. putdocx paragraph, style(Heading1)
r; t=0.00 15:22:54

. putdocx text ("Results")
r; t=0.00 15:22:54

. 
. * Figure 1: vdemhdi
. graph use "${graph}/vdemhdi.gph"
r; t=0.83 15:22:55

. graph export "${graph}/vdemhdi.png", width(3000) replace
file /Users/souleymane.yameogo/Library/CloudStorage/Dropbox/WP3_OnlineCivics/Conflict
    project/Conflict-Nigeria/Observationaldata/R9-Acled/JCR replication/output/graphs/vdemhdi.png
    saved as PNG format
r; t=0.77 15:22:55

. putdocx paragraph, halign(center)
r; t=0.00 15:22:55

. putdocx image ("${graph}/vdemhdi.png"), width(14cm)
r; t=0.10 15:22:55

. putdocx paragraph
r; t=0.00 15:22:55

. putdocx text ("Figure 1. V-Dem vs HDI"), italic
r; t=0.00 15:22:55

. 
. * Figure 2: fatalities
. graph use "${graph}/fatalities.gph"
r; t=1.84 15:22:57

. graph export "${graph}/fatalities.png", width(3000) replace
file /Users/souleymane.yameogo/Library/CloudStorage/Dropbox/WP3_OnlineCivics/Conflict
    project/Conflict-Nigeria/Observationaldata/R9-Acled/JCR replication/output/graphs/fatalities.png
    saved as PNG format
r; t=0.83 15:22:58

. putdocx paragraph, halign(center)
r; t=0.00 15:22:58

. putdocx image ("${graph}/fatalities.png"), width(14cm)
r; t=0.07 15:22:58

. putdocx paragraph
r; t=0.00 15:22:58

. putdocx text ("Figure 2. Fatalities over time"), italic
r; t=0.00 15:22:58

. 
. * Figure 3: libdem
. graph use "${graph}/libdem.gph"
r; t=1.82 15:23:00

. graph export "${graph}/libdem.png", width(3000) replace
file /Users/souleymane.yameogo/Library/CloudStorage/Dropbox/WP3_OnlineCivics/Conflict
    project/Conflict-Nigeria/Observationaldata/R9-Acled/JCR replication/output/graphs/libdem.png saved
    as PNG format
r; t=0.79 15:23:01

. putdocx paragraph, halign(center)
r; t=0.00 15:23:01

. putdocx image ("${graph}/libdem.png"), width(14cm)
r; t=0.06 15:23:01

. putdocx paragraph
r; t=0.00 15:23:01

. putdocx text ("Figure 3. Liberal democracy index (V-Dem)"), italic
r; t=0.00 15:23:01

. 
. * Figure 4: hdi
. graph use "${graph}/hdi.gph"
r; t=1.89 15:23:03

. graph export "${graph}/hdi.png", width(3000) replace
file /Users/souleymane.yameogo/Library/CloudStorage/Dropbox/WP3_OnlineCivics/Conflict
    project/Conflict-Nigeria/Observationaldata/R9-Acled/JCR replication/output/graphs/hdi.png saved as
    PNG format
r; t=0.73 15:23:03

. putdocx paragraph, halign(center)
r; t=0.00 15:23:03

. putdocx image ("${graph}/hdi.png"), width(14cm)
r; t=0.05 15:23:03

. putdocx paragraph
r; t=0.00 15:23:03

. putdocx text ("Figure 4. Human Development Index (HDI)"), italic
r; t=0.00 15:23:03

. 
. * Figure 5: gender
. graph use "${graph}/gender.gph"
r; t=1.77 15:23:05

. graph export "${graph}/gender.png", width(3000) replace
file /Users/souleymane.yameogo/Library/CloudStorage/Dropbox/WP3_OnlineCivics/Conflict
    project/Conflict-Nigeria/Observationaldata/R9-Acled/JCR replication/output/graphs/gender.png saved
    as PNG format
r; t=0.77 15:23:06

. putdocx paragraph, halign(center)
r; t=0.00 15:23:06

. putdocx image ("${graph}/gender.png"), width(14cm)
r; t=0.04 15:23:06

. putdocx paragraph
r; t=0.00 15:23:06

. putdocx text ("Figure 5. Gender differences"), italic
r; t=0.00 15:23:06

. 
. * Figure 6: age
. graph use "${graph}/age.gph"
r; t=1.76 15:23:08

. graph export "${graph}/age.png", width(3000) replace
file /Users/souleymane.yameogo/Library/CloudStorage/Dropbox/WP3_OnlineCivics/Conflict
    project/Conflict-Nigeria/Observationaldata/R9-Acled/JCR replication/output/graphs/age.png saved as
    PNG format
r; t=0.74 15:23:09

. putdocx paragraph, halign(center)
r; t=0.00 15:23:09

. putdocx image ("${graph}/age.png"), width(14cm)
r; t=0.04 15:23:09

. putdocx paragraph
r; t=0.00 15:23:09

. putdocx text ("Figure 6. Age effects"), italic
r; t=0.00 15:23:09

. 
. * Figure 7: Cross-country regression – Afrobarometer Round 9 and ACLED 2021-2023
. graph use "${graph}/DV1_countries.gph"
r; t=7.63 15:23:16

. graph export "${graph}/DV1_countries.png", width(3000) replace
file /Users/souleymane.yameogo/Library/CloudStorage/Dropbox/WP3_OnlineCivics/Conflict
    project/Conflict-Nigeria/Observationaldata/R9-Acled/JCR
    replication/output/graphs/DV1_countries.png saved as PNG format
r; t=0.80 15:23:17

. putdocx paragraph, halign(center)
r; t=0.02 15:23:17

. putdocx image ("${graph}/DV1_countries.png"), width(14cm)
r; t=0.12 15:23:17

. putdocx paragraph
r; t=0.00 15:23:17

. putdocx text ("Figure 7. Country-specific DV1 results"), italic
r; t=0.00 15:23:17

. 
. *----RUN this section after running the robustness results ----
. 
. * Figure 8: Cross-country regression – Afrobarometer Round 8 and GTD data,2019-2021
. graph use "${graph}/DV1_cntryr8gtd.gph"
r; t=3.23 15:23:20

. graph export "${graph}/DV1_cntryr8gtd.png", width(3000) replace
file /Users/souleymane.yameogo/Library/CloudStorage/Dropbox/WP3_OnlineCivics/Conflict
    project/Conflict-Nigeria/Observationaldata/R9-Acled/JCR
    replication/output/graphs/DV1_cntryr8gtd.png saved as PNG format
r; t=0.70 15:23:21

. putdocx paragraph, halign(center)
r; t=0.00 15:23:21

. putdocx image ("${graph}/DV1_cntryr8gtd.png"), width(14cm)
r; t=0.05 15:23:21

. putdocx paragraph
r; t=0.00 15:23:21

. putdocx text ("Figure 8. Country-specific DV1 results (R8-GTD)"), italic
r; t=0.00 15:23:21

. 
. * Figure 9: Afrobalance
. graph use "${graph}/Afrobalance.gph"
r; t=1.22 15:23:22

. graph export "${graph}/Afrobalance.png", width(3000) replace
file /Users/souleymane.yameogo/Library/CloudStorage/Dropbox/WP3_OnlineCivics/Conflict
    project/Conflict-Nigeria/Observationaldata/R9-Acled/JCR replication/output/graphs/Afrobalance.png
    saved as PNG format
r; t=0.71 15:23:23

. putdocx paragraph, halign(center)
r; t=0.00 15:23:23

. putdocx image ("${graph}/Afrobalance.png"), width(14cm)
r; t=0.11 15:23:23

. putdocx paragraph
r; t=0.00 15:23:23

. putdocx text ("Figure 9. Covariate balance (Afrobarometer)"), italic
r; t=0.00 15:23:23

. 
. * Figure 10: balance_afro (requires pre-existing graph file)
. graph use "${graph}/balance_afro.gph"
r; t=1.30 15:23:25

. graph export "${graph}/balance_afro.png", width(3000) replace
file /Users/souleymane.yameogo/Library/CloudStorage/Dropbox/WP3_OnlineCivics/Conflict
    project/Conflict-Nigeria/Observationaldata/R9-Acled/JCR replication/output/graphs/balance_afro.png
    saved as PNG format
r; t=0.99 15:23:26

. putdocx paragraph, halign(center)
r; t=0.00 15:23:26

. putdocx image ("${graph}/balance_afro.png"), width(14cm)
r; t=0.06 15:23:26

. putdocx paragraph
r; t=0.00 15:23:26

. putdocx text ("Figure 10. Covariate balance (Afrobarometer, alternative)"), italic
r; t=0.00 15:23:26

. 
. putdocx save all_graphs.docx, replace
successfully replaced "/Users/souleymane.yameogo/Library/CloudStorage/Dropbox/WP3_OnlineCivics/Conflict 
> project/Conflict-Nigeria/Observationaldata/R9-Acled/JCR replication/all_graphs.docx"
r; t=0.11 15:23:26

. 
. ***************************************************************
. * END OF DO-FILE
. ***************************************************************
. 
end of do-file

r; t=118.66 15:23:26
